我的应用程序中有一些 JavaScript 可以检测网络连接何时消失并临时将数据缓存在本地存储中,以便在重新建立连接时与服务器同步。
我一直试图找到一种使用 Capybara 进行端到端测试的方法,但我似乎找不到任何方法可以暂时禁用应用服务器或将无头浏览器切换到离线模式。FWIW 我使用 Poltergeist 作为驱动程序。
有谁知道如何进行测试?(我可以使用 sinon 来测试 JavaScript 应用程序来伪造服务器消失,但如果可能的话,我希望能够使用无头浏览器进行端到端测试)。
我正在尝试在我的应用程序中使用erlcloud库进行S3上传.作为测试,我试图通过iex控制台来列出存储桶:
iex(4)> s3 = :erlcloud_s3.new("KEY_ID", "SECRET_KEY")
...
iex(5)> :erlcloud_s3.list_buckets(s3)
** (ErlangError) erlang error: {:aws_error, {:socket_error, :timeout}}
(erlcloud) src/erlcloud_s3.erl:909: :erlcloud_s3.s3_request/8
(erlcloud) src/erlcloud_s3.erl:893: :erlcloud_s3.s3_xml_request/8
(erlcloud) src/erlcloud_s3.erl:238: :erlcloud_s3.list_buckets/1
Run Code Online (Sandbox Code Playgroud)
我已经检查过了inets,ssl并且erlcoud都已经启动了,我知道凭证工作正常,因为我已经用类似的方式测试了它们的Ruby库irb.
我尝试使用更长的超时配置它,但无论我设置多高,我仍然会收到此错误.
有任何想法吗?或者我可以采取哪些方法来调试它?
我正在使用Rails 4并设计3.2.在注册时,通过电子邮件向新注册的用户发送激活/确认链接.我已经在Devise wiki中的这篇文章中实现了这一点.
每当我输入相同的密码时,他们都会毫无问题地登录,但是当我在第一次尝试中输入密码错误并且在第二次尝试时输入相同的密码时,它不起作用.
这是出现的错误
NoMethodError in ConfirmationsController#update
undefined method `add_error_on' for ConfirmationsController:Class
Run Code Online (Sandbox Code Playgroud)
class ConfirmationsController < Devise::ConfirmationsController
skip_before_filter :require_no_authentication
skip_before_filter :authenticate_user!
# PUT /resource/confirmation
def update
with_unconfirmed_confirmable do
if @confirmable.has_no_password?
@confirmable.attempt_set_password(params[:user])
if @confirmable.valid? and @confirmable.password_match?
do_confirm
else
do_show
@confirmable.errors.clear #so that we wont render :new
end
else
self.class.add_error_on(self, :email, :password_already_set)
end
end
if !@confirmable.errors.empty?
render 'devise/confirmations/new'
end
end
# GET /resource/confirmation?confirmation_token=abcdef
def show
with_unconfirmed_confirmable do
if @confirmable.has_no_password?
do_show
else
do_confirm
end
end
if !@confirmable.errors.empty?
self.resource …Run Code Online (Sandbox Code Playgroud)