-
Notifications
You must be signed in to change notification settings - Fork 0
/
spec_helper.rb
48 lines (39 loc) · 1.26 KB
/
spec_helper.rb
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
42
43
44
45
46
47
48
# This fie 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 'simplecov'
SimpleCov.minimum_coverage 90
SimpleCov.start do
add_group 'Models', ['app/models', 'spec/models']
add_group 'Controllers', ['app/controllers', 'spec/controllers']
end
# 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 }
Shoulda::Matchers.configure do |config|
config.integrate do |with|
with.test_framework :rspec
with.library :rails
end
end
RSpec.configure do |config|
config.include FactoryGirl::Syntax::Methods
config.include ApplicationHelper
config.include FactoryGirl::Syntax::Methods
DatabaseCleaner.orm = 'active_record'
config.infer_spec_type_from_file_location!
config.infer_base_class_for_anonymous_controllers = false
config.order = 'random'
config.before(:suite) do
FactoryGirl.lint
DatabaseCleaner.clean_with :truncation
DatabaseCleaner.strategy = :transaction
end
config.before(:each) do
DatabaseCleaner.start
end
config.after(:each) do
DatabaseCleaner.clean
end
end