2015-11-04 84 views
0

我的測試有如何參考rspec-capybara功能測試的路線?

scenario 'with all required fields entered' do 
    fill_out_form zip.zip_code 
    click_button(page_object.eqv_continue_button) 
    expect(page).to have_css(page_object.css_vehicle1_ownership) 
    expect(current_path).to eq(landings_path) 
end 

,但我得到

/Users/pengo/eq/lynx/spec/features/full_flows/3_step_minimal_foundation_spec.rb:23: 
in `block (2 levels) in <top (required)>': undefined local variable or method `landings_path' for #<Class:0x007fe320eba310> (NameError) 

回答

0

如果您使用RSpec的護欄和測試標記有:類型=>:功能 那麼URL傭工應包括自動。如果沒有,您可以嘗試通過您的RSpec配置包括它們

RSpec.configure do |config| 
    config.include Rails.application.routes.url_helpers 
    ... 
end