Created
April 25, 2014 19:28
-
-
Save mcelaney/11300337 to your computer and use it in GitHub Desktop.
Spec Helper Example
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 'simplecov' | |
SimpleCov.start 'rails' | |
require 'rubygems' | |
require 'spork' | |
#uncomment the following line to use spork with the debugger | |
#require 'spork/ext/ruby-debug' | |
Spork.prefork do | |
# 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 'paperclip/matchers' | |
require 'capybara/rspec' | |
require 'capybara/poltergeist' | |
Capybara.javascript_driver = :poltergeist | |
# 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.include(MailerMacros) | |
# config.before(:each) { reset_email } | |
config.filter_run focus: true | |
config.filter_run_excluding broken: true | |
config.run_all_when_everything_filtered = true | |
config.before(:all) { DeferredGarbageCollection.start } | |
config.after(:all) { DeferredGarbageCollection.reconsider } | |
config.use_transactional_fixtures = false | |
config.infer_base_class_for_anonymous_controllers = false | |
config.before(:suite) do | |
DatabaseCleaner.strategy = :truncation | |
end | |
config.before(:each) do | |
DatabaseCleaner.start | |
end | |
config.after(:each) do | |
DatabaseCleaner.clean | |
end | |
config.treat_symbols_as_metadata_keys_with_true_values = true | |
config.filter_run :focus => true | |
config.run_all_when_everything_filtered = true | |
config.include FactoryGirl::Syntax::Methods | |
# 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 Paperclip::Shoulda::Matchers | |
# config.include AuthMacros | |
end | |
end | |
Spork.each_run do | |
# This code will be run each time you run your specs. | |
FactoryGirl.reload | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment