2011-02-11 08:44:58 -05:00
|
|
|
require 'spec_helper'
|
|
|
|
require 'capybara/rspec'
|
|
|
|
|
2011-03-13 09:31:04 -04:00
|
|
|
RSpec.configuration.before(:each, :example_group => {:file_path => __FILE__}) do
|
|
|
|
@in_filtered_hook = true
|
|
|
|
end
|
|
|
|
|
2011-02-11 08:44:58 -05:00
|
|
|
feature "Capybara's feature DSL" do
|
|
|
|
background do
|
2012-01-03 11:18:42 -05:00
|
|
|
Capybara.app = TestApp
|
2011-02-11 08:44:58 -05:00
|
|
|
@in_background = true
|
|
|
|
end
|
|
|
|
|
|
|
|
scenario "includes Capybara" do
|
|
|
|
visit('/')
|
|
|
|
page.should have_content('Hello world!')
|
|
|
|
end
|
|
|
|
|
|
|
|
scenario "preserves description" do
|
|
|
|
example.metadata[:full_description].should == "Capybara's feature DSL preserves description"
|
|
|
|
end
|
|
|
|
|
|
|
|
scenario "allows driver switching", :driver => :selenium do
|
|
|
|
Capybara.current_driver.should == :selenium
|
|
|
|
end
|
|
|
|
|
|
|
|
scenario "runs background" do
|
|
|
|
@in_background.should be_true
|
|
|
|
end
|
2011-03-31 12:05:58 -04:00
|
|
|
|
2011-03-13 09:31:04 -04:00
|
|
|
scenario "runs hooks filtered by file path" do
|
|
|
|
@in_filtered_hook.should be_true
|
|
|
|
end
|
2011-03-31 12:05:58 -04:00
|
|
|
|
2011-03-12 06:38:48 -05:00
|
|
|
scenario "doesn't pollute the Object namespace" do
|
|
|
|
Object.new.respond_to?(:feature, true).should be_false
|
|
|
|
end
|
2011-02-11 08:44:58 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
feature "Capybara's feature DSL with driver", :driver => :culerity do
|
|
|
|
scenario "switches driver" do
|
|
|
|
Capybara.current_driver.should == :culerity
|
|
|
|
end
|
|
|
|
end
|