Files
ch420/spec/spec_helper.rb
T

62 lines
2.1 KiB
Ruby
Raw Normal View History

2015-10-02 22:03:51 +02:00
# 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 'mongoid-rspec'
Mongo::Logger.logger.level = Logger::WARN # Set log level to DEBUG to see everything
Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f }
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
RSpec.configure do |config|
config.include Mongoid::Matchers, type: :model
2017-04-13 17:16:03 +02:00
config.include FactoryGirl::Syntax::Methods
config.before(:suite) do
FactoryGirl.find_definitions
end
config.include Devise::Test::ControllerHelpers, type: :controller
config.include Devise::Test::ControllerHelpers, type: :view
config.include Devise::Test::IntegrationHelpers, type: :feature
2015-10-02 22:03:51 +02:00
# rspec-expectations config goes here. You can use an alternate
# assertion/expectation library such as wrong or the stdlib/minitest
# assertions if you prefer.
config.expect_with :rspec do |expectations|
# This option will default to `true` in RSpec 4. It makes the `description`
# and `failure_message` of custom matchers include text for helper methods
# defined using `chain`, e.g.:
# be_bigger_than(2).and_smaller_than(4).description
# # => "be bigger than 2 and smaller than 4"
# ...rather than:
# # => "be bigger than 2"
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
end
# rspec-mocks config goes here. You can use an alternate test double
# library (such as bogus or mocha) by changing the `mock_with` option here.
config.mock_with :rspec do |mocks|
# Prevents you from mocking or stubbing a method that does not exist on
# a real object. This is generally recommended, and will default to
# `true` in RSpec 4.
mocks.verify_partial_doubles = true
end
config.order = :random
config.after(:each) do
Mongoid.purge!
end
2016-04-08 15:22:31 +02:00
config.before(:each) do
ActionMailer::Base.deliveries.clear
end
2015-10-02 22:03:51 +02:00
end