Created
January 12, 2012 01:32
-
-
Save timurvafin/1597910 to your computer and use it in GitHub Desktop.
Integration tests with rspec, capybara and selenium
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source :rubygems | |
gem 'rspec' | |
gem 'capybara' | |
gem 'json' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'spec_helper' | |
describe 'news letter box' do | |
before do | |
visit '/' | |
end | |
it 'should has link' do | |
page.should have_content 'You get it monthly' | |
end | |
it 'shoud be hidden by default' do | |
page.find('.mc-embed-form.subscribe').should_not be_visible | |
end | |
it 'link should open box with textfield' do | |
page.click_link 'You get it monthly' | |
page.find('.mc-embed-form.subscribe').should be_visible | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'bundler/setup' | |
require 'capybara' | |
require 'capybara/dsl' | |
require 'rspec/core' | |
require 'capybara/rspec/matchers' | |
require 'capybara/rspec/features' | |
Capybara.register_driver :selenium do |app| | |
Capybara::Selenium::Driver.new(app, :browser => :chrome) | |
end | |
Capybara.default_driver = :selenium | |
Capybara.app_host = 'http://stage.flatstack.com' | |
RSpec.configure do |config| | |
config.include Capybara::DSL | |
config.include Capybara::RSpecMatchers | |
config.after do | |
Capybara.reset_sessions! | |
Capybara.use_default_driver | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment