Skip to content

Instantly share code, notes, and snippets.

@timurvafin
Created January 12, 2012 01:32
Show Gist options
  • Save timurvafin/1597910 to your computer and use it in GitHub Desktop.
Save timurvafin/1597910 to your computer and use it in GitHub Desktop.
Integration tests with rspec, capybara and selenium
source :rubygems
gem 'rspec'
gem 'capybara'
gem 'json'
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
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