使用rspec和capybara開發新的Rails 3.2.9應用程序。爲什麼要求規格中沒有水豚?
我已經中的Gemfile如下:
gem 'rspec-rails'
gem 'capybara'
和投機/ spec_helper.rb如下:
require 'rspec/rails'
require 'capybara/rspec'
和投機/請求/ asdf_spec.rb:
require 'spec_helper'
describe 'Asdf' do
describe "GET /asdfs" do
it "should list asdfs" do
visit asdfs_path
end
end
end
此測試失敗:
Failure/Error: visit asdfs_path
NoMethodError:
undefined method `visit' for #<RSpec::Core::ExampleGroup::Nested_1::Nested_2::Nested_1:0x007fa7b68961a0>
# ./spec/requests/asdfs_spec.rb:19:in `block (4 levels) in <top (required)>'
所以它看起來像水豚沒有得到加載。確定,爲什麼不呢?我覺得我在十幾次之前完成了同樣的事情......可能會在一些愚蠢的事情上消失。
您是否使用Capybara 2.0? –
是的,我是!我的谷歌搜索功能很弱。 –