运行rspec测试时,Rails ActionView :: Helpers :: TextHelper中的ArgumentError(3 for 1)

时间:2013-04-18 16:13:02

标签: ruby-on-rails rspec capybara actionview argument-error

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

使用:

  • ruby​​ 1.9.3p392
  • rails 3.2.12
  • rspec 2.13.0
  • capybara 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'

然而,当我一次运行一个测试时,我没有任何问题。这对我来说是令人难以置信的,任何人可能对此有任何见解都将受到高度赞赏! 重要的是要知道这只发生在使用默认驱动程序而不是硒测试的验收测试中。此外,此错误仅在升级到Capybara 2.1.0后发生。

1 个答案:

答案 0 :(得分:0)

我得到了同样的错误。有些人说,问题是include ActionView::Helpers::TextHelper。就我而言,我把它包含在一个模型中。幸运的是,我可以将其从模型中删除,并清除此错误。