public
Created

These are my two spec_helper files for the suite

  • Download Gist
acceptance_spec_helper.rb
Ruby
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
require "capybara/rspec"
require 'rspec/example_steps'
require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
require File.expand_path(File.dirname(__FILE__) + "/support/helpers")
require File.expand_path(File.dirname(__FILE__) + "/support/paths")
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
 
include ApplicationHelper
include HelperMethods
include FacebookAuthHelper
include NavigationHelpers
 
include Warden::Test::Helpers
Warden.test_mode!
 
DatabaseCleaner.strategy = :truncation
Capybara.default_selector = :css
Capybara.save_and_open_page_path = File.expand_path(File.dirname(__FILE__) + "/../tmp/")
Capybara.default_wait_time = 35.
Capybara.server_port = 8888 + ENV['TEST_ENV_NUMBER'].to_i
 
RSpec.configure do |config|
config.include Capybara::DSL
Capybara.server_boot_timeout = 50
config.use_transactional_fixtures = false
 
DatabaseCleaner.clean
 
config.before(:each) do
Capybara.server_boot_timeout = 50
if example.options[:js]
Capybara.current_driver = :selenium
Capybara.current_session.driver.browser.manage.window.resize_to(1600,1200)
end
end
 
config.after(:each) do
Capybara.use_default_driver if example.options[:js]
Warden.test_reset!
end
end
spec_helper.rb
Ruby
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
require 'database_cleaner'
require 'factory_girl'
require 'timecop'
require 'webmock/rspec'
require "paperclip/matchers"
require 'vcr'
 
WebMock.disable_net_connect!(:allow_localhost => true)
 
# 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'
 
DatabaseCleaner.strategy = :transaction
 
# 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|
config.mock_with :rspec
config.include Paperclip::Shoulda::Matchers
config.include Devise::TestHelpers, :type => :controller
 
config.before(:each) do
#clear_redis_queues
#Resque::Delayed.clear
DatabaseCleaner.start
end
 
config.after(:each) do
Timecop.return
DatabaseCleaner.clean
end
 
config.include(EmailSpec::Helpers)
config.include(EmailSpec::Matchers)
end
 
Resque.inline = false

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.