我正在运行一个功能规范来测试一些Rails代码。虽然此规范运行良好,但是需要测试一些Javascript。
根据文档,我已将 :js => true 标志添加到场景中。然而,当我这样做时,我遇到了以下错误:
Failures:
1) User can check off items as being owned user can check off an item on the checklist
Failure/Error: Unable to find matching line from backtrace
Errno::EADDRINUSE:
Address already in use - bind(2) for 127.0.0.1:3000
# /Users/agazoom/.rvm/gems/ruby-2.2.1@kollista/gems/rack-1.6.0/lib/rack/handler/webrick.rb:32:in `new'
# /Users/agazoom/.rvm/gems/ruby-2.2.1@kollista/gems/rack-1.6.0/lib/rack/handler/webrick.rb:32:in `run'
# /Users/agazoom/.rvm/gems/ruby-2.2.1@kollista/gems/capybara-2.4.4/lib/capybara.rb:173:in `run_default_server'
# /Users/agazoom/.rvm/gems/ruby-2.2.1@kollista/gems/capybara-2.4.4/lib/capybara.rb:359:in `block (2 levels) in <top (required)>'
# /Users/agazoom/.rvm/gems/ruby-2.2.1@kollista/gems/capybara-2.4.4/lib/capybara/server.rb:70:in `call'
# /Users/agazoom/.rvm/gems/ruby-2.2.1@kollista/gems/capybara-2.4.4/lib/capybara/server.rb:70:in `block in boot'
下面列出了测试内容。这很奇怪,因为当我去掉js标志时,这个东西运行得很好。
scenario "user can check off an item on the checklist", :js => true do
visit root_path
expect(page).to have_title("agazoom")
end