Created
May 8, 2013 16:41
-
-
Save thedelchop/5541750 to your computer and use it in GitHub Desktop.
These are my two spec_helper files for the suite
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 "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 |
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 '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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment