Created
February 7, 2012 05:47
-
-
Save diazruy/1757499 to your computer and use it in GitHub Desktop.
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 'spork' | |
Spork.prefork do | |
ENV["RAILS_ENV"] ||= 'test' | |
require File.expand_path("../../config/environment", __FILE__) | |
require 'rspec/rails' | |
require 'rspec/autorun' | |
# 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} | |
Capybara.javascript_driver = :webkit | |
RSpec.configure do |config| | |
# == Mock Framework | |
config.mock_with :rspec | |
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures | |
config.fixture_path = "#{::Rails.root}/spec/fixtures" | |
# 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 | |
config.before(:suite) do | |
DatabaseCleaner.strategy = :transaction | |
DatabaseCleaner.clean_with(:truncation) | |
end | |
config.before(:each, :type => :request, :js => true) do | |
DatabaseCleaner.strategy = :truncation | |
end | |
config.before(:each, :type => :request) do | |
DatabaseCleaner.start | |
end | |
config.after(:each, :type => :request) do | |
DatabaseCleaner.clean | |
end | |
# If true, the base class of anonymous controllers will be inferred | |
# automatically. This will be the default behavior in future versions of | |
# rspec-rails. | |
config.infer_base_class_for_anonymous_controllers = false | |
# Allow simple symbols instead of hashes to tag specs | |
config.treat_symbols_as_metadata_keys_with_true_values = true | |
end | |
end | |
Spork.each_run do | |
Splitsee3::Application.reload_routes! | |
ActiveSupport::Dependencies.clear | |
ActiveRecord::Base.instantiate_observers | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment