在运行rspec测试时,Rails ActionView::Helpers::TextHelper中的ArgumentE



我正在将我们的测试套件升级到Capybara 2.1,并且在运行测试套件时遇到了最奇怪的问题。

使用:

    ruby 1.9.3p392
  • rails 3.2.12
  • rspec 2.13.0
  • 水豚2.1.0的

当我为整个套件运行测试时(使用描述性格式同时失败):

rspec spec/acceptance/non-webdriver-dependent/ --fail-fast -f d

抛出以下错误:

Failure/Error: within(".sidebar") do
 ArgumentError:
   wrong number of arguments (3 for 1)

当使用--backtrace选项运行时,报告如下:

# /Users/steve/.rvm/gems/ruby-1.9.3-p392/gems/actionpack-3.2.12/lib/action_view/helpers/text_helper.rb:51:in `concat'
# /Users/steve/.rvm/gems/ruby-1.9.3-p392/gems/nokogiri-1.5.9/lib/nokogiri/xml/node.rb:159:in `evaluate'
# /Users/steve/.rvm/gems/ruby-1.9.3-p392/gems/nokogiri-1.5.9/lib/nokogiri/xml/node.rb:159:in `block in xpath'
# /Users/steve/.rvm/gems/ruby-1.9.3-p392/gems/nokogiri-1..9/lib/nokogiri/xml/node.rb:150:in `map'
# /Users/steve/.rvm/gems/ruby-1.9.3-p392/gems/nokogiri-1.5.9/lib/nokogiri/xml/node.rb:150:in `xpath'
# /Users/steve/.rvm/gems/ruby-1.9.3-p392/gems/nokogiri-1.5.9/lib/nokogiri/xml/node.rb:214:in `css'
# /Users/steve/.rvm/gems/ruby-1.9.3-p392/gems/capybara-2.1.0/lib/capybara/rack_test/browser.rb:85:in `find'
# /Users/steve/.rvm/gems/ruby-1.9.3-p392/gems/capybara-2.1.0/lib/capybara/rack_test/driver.rb:70:in `find_css'
# /Users/steve/.rvm/gems/ruby-1.9.3-p392/gems/capybara-2.1.0/lib/capybara/node/finders.rb:152:in `block in resolve_query'
# /Users/steve/.rvm/gems/ruby-1.9.3-p392/gems/capybara-2.1.0/lib/capybara/node/base.rb:77:in `synchronize'
# /Users/steve/.rvm/gems/ruby-1.9.3-p392/gems/capybara-2.1.0/lib/capybara/node/finders.rb:150:in `resolve_query'
# /Users/steve/.rvm/gems/ruby-1.9.3-p392/gems/capybara-2.1.0/lib/capybara/node/finders.rb:35:in `block in find'
# /Users/steve/.rvm/gems/ruby-1.9.3-p392/gems/capybara-2.1.0/lib/capybara/node/base.rb:81:in `synchronize'
# /Users/steve/.rvm/gems/ruby-1.9.3-p392/gems/capybara-2.1.0/lib/capybara/node/finders.rb:30:in `find'
# /Users/steve/.rvm/gems/ruby-1.9.3-p392/gems/capybara-2.1.0/lib/capybara/session.rb:354:in `block (2 levels) in <class:Session>'
# /Users/steve/.rvm/gems/ruby-1.9.3-p392/gems/capybara-2.1.0/lib/capybara/session.rb:221:in `within'
# /Users/steve/.rvm/gems/ruby-1.9.3-p392/gems/capybara-2.1.0/lib/capybara/dsl.rb:51:in `block (2 levels) in <module:DSL>'
# ./spec/acceptance/non-webdriver-dependent/bronze/company_job_postings_index_sidebar_spec.rb:15:in `block (3 levels) in <top (required)>'
# /Users/steve/.rvm/gems/ruby-1.9.3-p392/gems/rspec-core-2.13.1/lib/rspec/core/example.rb:114:in `instance_eval'
# /Users/steve/.rvm/gems/ruby-1.9.3-p392/gems/rspec-core-2.13.1/lib/rspec/core/example.rb:114:in `block in run'
# /Users/steve/.rvm/gems/ruby-1.9.3-p392/gems/rspec-core-2.13.1/lib/rspec/core/example.rb:254:in `with_around_each_hooks'
# /Users/steve/.rvm/gems/ruby-1.9.3-p392/gems/rspec-core-2.13.1/lib/rspec/core/example.rb:111:in `run'
# /Users/steve/.rvm/gems/ruby-1.9.3-p392/gems/rspec-core-2.13.1/lib/rspec/core/example_group.rb:390:in `block in run_examples'
# /Users/steve/.rvm/gems/ruby-1.9.3-p392/gems/rspec-core-2.13.1/lib/rspec/core/example_group.rb:386:in `map'
# /Users/steve/.rvm/gems/ruby-1.9.3-p392/gems/rspec-core-2.13.1/lib/rspec/core/example_group.rb:386:in `run_examples'
# /Users/steve/.rvm/gems/ruby-1.9.3-p392/gems/rspec-core-2.13.1/lib/rspec/core/example_group.rb:371:in `run'
# /Users/steve/.rvm/gems/ruby-1.9.3-p392/gems/rspec-core-2.13.1/lib/rspec/core/example_group.rb:372:in `block in run'
# /Users/steve/.rvm/gems/ruby-1.9.3-p392/gems/rspec-core-2.13.1/lib/rspec/core/example_group.rb:372:in `map'
# /Users/steve/.rvm/gems/ruby-1.9.3-p392/gems/rspec-core-2.13.1/lib/rspec/core/example_group.rb:372:in `run'
# /Users/steve/.rvm/gems/ruby-1.9.3-p392/gems/rspec-core-2.13.1/lib/rspec/core/command_line.rb:28:in `block (2 levels) in run'
# /Users/steve/.rvm/gems/ruby-1.9.3-p392/gems/rspec-core-2.13.1/lib/rspec/core/command_line.rb:28:in `map'
# /Users/steve/.rvm/gems/ruby-1.9.3-p392/gems/rspec-core-2.13.1/lib/rspec/core/command_line.rb:28:in `block in run'
# /Users/steve/.rvm/gems/ruby-1.9.3-p392/gems/rspec-core-2.13.1/lib/rspec/core/reporter.rb:34:in `report'
# /Users/steve/.rvm/gems/ruby-1.9.3-p392/gems/rspec-core-2.13.1/lib/rspec/core/command_line.rb:25:in `run'
# /Users/steve/.rvm/gems/ruby-1.9.3-p392/gems/rspec-core-2.13.1/lib/rspec/core/runner.rb:80:in `run'
# /Users/steve/.rvm/gems/ruby-1.9.3-p392/gems/rspec-core-2.13.1/lib/rspec/core/runner.rb:17:in `block in autorun'

然而,当我一次运行一个测试时,我没有任何问题。这对我来说是令人难以置信的,任何有洞察力的人都可能对此非常感激!重要的是要知道这只发生在使用默认驱动程序的验收测试中,而不是在selenium测试中。此外,此错误仅在升级到capybara 2.1.0后发生。

我得到了同样的错误。就像有些人说的,问题是include ActionView::Helpers::TextHelper。在我的例子中,我把它包含在一个模型中。幸运的是,我可以从模型中删除它,这个错误被清除。

相关内容

  • 没有找到相关文章

最新更新