2016-12-13 55 views
1

根據水豚的readme在Github上我有權要求豚/在我的spec_helper軌文件安裝寶石後:爲什麼不我需要需要「水豚/軌」中spec_helper

require 'capybara/rails' 

但即使我離開了在spec_helper需要聲明,我仍然可以使用下面的水豚語法:

scenario "successfully creates a new user account" do 
    visit "users#index" 
    fill_in "user_email", with: "[email protected]" 
    click_button "Create User" 
    expect(page).to have_content "User successfully created" 
    end 

是否有事可做與軌道摹RSpec的:install命令?我對語法的工作原因感到困惑;該應用程序如何知道?

回答

0

所有需要水豚/鐵軌的人都會設置Capybara.app並將機架測試驅動程序配置爲尊重鏈接上的任何data-method屬性。除此之外,它不影響水豚。如果您已經以其他方式配置了Capybara.app,那麼事情會正常工作。您可能還需要在您的rails_helper.rb而不是spec_helper.rb