2011-05-23 61 views

回答

2

切換到硒司機爲場景:

# in a new file: spec/acceptance/support/javascript.rb 
RSpec.configure do |config| 

    config.before(:each) do 
    Capybara.current_driver = :selenium if example.metadata[:js] 
    end 

    config.after(:each) do 
    Capybara.use_default_driver if example.metadata[:js] 
    end 
end 

# in your feature 
scenario "Scenario that needs Javascript", :js => true do 
    #... 
end 

scenario "Scenario that doesn't need Javascript" do 
    #... 
end 

原來是在這裏:https://gist.github.com/448487但已經被編輯過棄用。