你好,我遇到了railstutorial的问题。rspec:未定义方法'has_conent?'
我有测试文件features/static_pages_spec.rb
require 'spec_helper'
describe "Static pages" do
describe "Home page" do
it "Should have the content 'Sample App'" do
visit '/static_pages/home'
page.should have_conent('Sample App')
end
end
end
当我运行bundle exec rspec spec/features/static_pages_spec.rb
我收到以下错误:
Failures:
1) Static pages Home page Should have the content 'Sample App'
Failure/Error: page.should have_conent('Sample App')
NoMethodError:
undefined method `has_conent?' for #<Capybara::Session>
# ./spec/features/static_pages_spec.rb:9:in `block (3 levels) in <top (required)>'
Finished in 0.05262 seconds
1 example, 1 failure
Failed examples:
rspec ./spec/features/static_pages_spec.rb:6 # Static pages Home page Should have the content 'Sample App'
Randomized with seed 49777
我试图在spec_helper.rb
config.include Capybara::DSL
增加,但它给了我同样的错误。
感谢我没有看到这个愚蠢的错误 –
它发生:)如果它帮助,请检查答案所以它出来的“悬而未决”队列 – dax