Skip to content

Commit

Permalink
added rspec test environment
Browse files Browse the repository at this point in the history
  • Loading branch information
dylandrop committed Nov 22, 2013
1 parent 056d066 commit 027a318
Show file tree
Hide file tree
Showing 3 changed files with 132 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,17 @@ group :development do
gem 'pry-debugger'
end

group :test do
gem 'database_cleaner'
gem 'rspec-rails'
gem 'factory_girl_rails'
gem 'launchy'
gem 'capybara', '~> 2.1'
gem "shoulda-matchers"
gem 'selenium-webdriver'
gem "capybara-webkit", '~> 1.0', require: false
end

# Gems used only for assets and not required
# in production environments by default.
group :assets do
Expand Down
52 changes: 52 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ GEM
activesupport (3.2.13)
i18n (= 0.6.1)
multi_json (~> 1.0)
addressable (2.3.5)
arel (3.0.2)
aws-s3 (0.6.3)
builder
Expand All @@ -42,8 +43,19 @@ GEM
binding_of_caller (0.7.2)
debug_inspector (>= 0.0.1)
builder (3.0.4)
capybara (2.1.0)
mime-types (>= 1.16)
nokogiri (>= 1.3.3)
rack (>= 1.0.0)
rack-test (>= 0.5.4)
xpath (~> 2.0)
capybara-webkit (1.0.0)
capybara (~> 2.0, >= 2.0.2)
json
celluloid (0.15.2)
timers (~> 1.1.0)
childprocess (0.3.9)
ffi (~> 1.0, >= 1.0.11)
cocaine (0.2.1)
coderay (1.0.9)
coffee-rails (3.2.2)
Expand All @@ -56,6 +68,7 @@ GEM
columnize (0.3.6)
connection_pool (1.1.0)
daemons (1.1.9)
database_cleaner (1.1.1)
debug_inspector (0.0.2)
debugger (1.6.0)
columnize (>= 0.3.1)
Expand All @@ -68,11 +81,18 @@ GEM
orm_adapter (~> 0.1)
railties (~> 3.1)
warden (~> 1.2.1)
diff-lcs (1.1.3)
erubis (2.7.0)
eventmachine (1.0.3)
execjs (2.0.2)
factory_girl (4.2.0)
activesupport (>= 3.0.0)
factory_girl_rails (4.2.1)
factory_girl (~> 4.2.0)
railties (>= 3.0.0)
faraday (0.8.7)
multipart-post (~> 1.1)
ffi (1.9.0)
haml (3.1.8)
hashie (2.0.4)
hike (1.2.3)
Expand All @@ -88,6 +108,8 @@ GEM
json (1.8.0)
jwt (0.1.8)
multi_json (>= 1.5)
launchy (2.3.0)
addressable (~> 2.3)
mail (2.5.4)
mime-types (~> 1.16)
treetop (~> 1.4.8)
Expand Down Expand Up @@ -181,11 +203,30 @@ GEM
redis (~> 3.0.0)
rest-client (1.6.7)
mime-types (>= 1.16)
rspec-core (2.12.2)
rspec-expectations (2.12.1)
diff-lcs (~> 1.1.3)
rspec-mocks (2.12.2)
rspec-rails (2.12.2)
actionpack (>= 3.0)
activesupport (>= 3.0)
railties (>= 3.0)
rspec-core (~> 2.12.0)
rspec-expectations (~> 2.12.0)
rspec-mocks (~> 2.12.0)
rubyzip (0.9.9)
sass (3.2.12)
sass-rails (3.2.6)
railties (~> 3.2.0)
sass (>= 3.1.10)
tilt (~> 1.3)
selenium-webdriver (2.34.0)
childprocess (>= 0.2.5)
multi_json (~> 1.0)
rubyzip
websocket (~> 1.0.4)
shoulda-matchers (1.2.0)
activesupport (>= 3.0.0)
sidekiq (2.15.1)
celluloid (>= 0.15.1)
connection_pool (>= 1.0.0)
Expand Down Expand Up @@ -226,17 +267,25 @@ GEM
uuidtools (2.1.2)
warden (1.2.1)
rack (>= 1.0)
websocket (1.0.7)
xml-simple (1.1.2)
xpath (2.0.0)
nokogiri (~> 1.3)

PLATFORMS
ruby

DEPENDENCIES
aws-s3
aws-sdk
capybara (~> 2.1)
capybara-webkit (~> 1.0)
coffee-rails (~> 3.2.1)
database_cleaner
devise
factory_girl_rails
jquery-rails
launchy
mailcatcher
mailjet
omniauth
Expand All @@ -248,7 +297,10 @@ DEPENDENCIES
pry-remote
pry-stack_explorer
rails (= 3.2.13)
rspec-rails
sass-rails (~> 3.2.3)
selenium-webdriver
shoulda-matchers
sidekiq
stripe
uglifier (>= 1.0.3)
69 changes: 69 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# This file is copied to spec/ when you run 'rails generate rspec:install'
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
require 'rspec/autorun'
require 'capybara-webkit'
require 'pry'
# Add this to load Capybara integration:
require 'capybara/rspec'
require 'capybara/rails'
# require 'support/integration_spec_helper'
require 'shoulda/matchers'
require 'paperclip/matchers'

# Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and its subdirectories.
# Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}

RSpec.configure do |config|
# ## Mock Framework
#
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
#
# config.mock_with :mocha
# config.mock_with :flexmock
# config.mock_with :rr

# If you're not using ActiveRecord, or you'd prefer not to run each of your
# examples within a transaction, remove the following line or assign false
# instead of true.
config.use_transactional_fixtures = false

Capybara.javascript_driver = :webkit

config.before(:suite) do
DatabaseCleaner.strategy = :truncation
DatabaseCleaner.clean_with(:truncation)
end

config.before(:each) do
DatabaseCleaner.start
end

config.after(:each) do
DatabaseCleaner.clean
end

config.before(:each, :selenium=>true) do
@old_capybara_driver = Capybara.current_driver
Capybara.current_driver = :selenium
end

config.include Capybara::DSL, :type => :request

# Run specs in random order to surface order dependencies. If you find an
# order dependency and want to debug it, you can fix the order by providing
# the seed, which is printed after each run.
# --seed 1234
config.order = "random"
config.include FactoryGirl::Syntax::Methods
config.include Devise::TestHelpers, :type => :controller
config.include Paperclip::Shoulda::Matchers
end

Capybara.register_driver :selenium do |app|
Capybara::Selenium::Driver.new(app, :browser => :firefox)
end

OmniAuth.config.test_mode = true

0 comments on commit 027a318

Please sign in to comment.