Skip to content

Instantly share code, notes, and snippets.

@RSpace
Created April 23, 2011 12:49
Show Gist options
  • Save RSpace/938578 to your computer and use it in GitHub Desktop.
Save RSpace/938578 to your computer and use it in GitHub Desktop.
Running Capybara and RSpec without Rails
source 'http://rubygems.org'
gem 'rspec'
gem 'capybara', :git => 'https://github.com/jnicklas/capybara.git'
gem 'launchy'
gem 'ruby-debug19'
require File.dirname(__FILE__) + '/../spec_helper'
describe "sign in", :type => :request do
it "should sign me in" do
# Sign in and make assertions
end
end
require 'rubygems'
require 'bundler/setup'
require 'ruby-debug'
require 'rspec'
require 'capybara/rspec'
Dir.glob(File.dirname(__FILE__) + '/factories/*', &method(:require))
# Capybara configuration
Capybara.default_driver = :selenium
Capybara.save_and_open_page_path = File.dirname(__FILE__) + '/../snapshots'
# RSpec configuration
RSpec.configure do |config|
config.before(:all) do
# Create fixtures
end
config.after(:all) do
# Destroy fixtures
end
config.around(:each) do |example|
begin
example.run
rescue Exception => ex
save_and_open_page
raise ex
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment