-
-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathrails_helper.rb
49 lines (37 loc) · 1.38 KB
/
rails_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
49
# frozen_string_literal: true
require 'spec_helper'
ENV['RAILS_ENV'] = 'test'
require File.expand_path('dummy/config/environment.rb', __dir__)
abort('The Rails environment is running in production mode!') if Rails.env.production?
require 'rspec/rails'
require 'capybara/rails'
require 'webmock/rspec'
Dir[File.expand_path('support/**/*.rb', __dir__)].sort.each { |f| require f }
# Force deprecations to raise an exception.
# ActiveSupport::Deprecation.behavior = :raise
# Checks for pending migrations and applies them before tests are run.
# If you are not using ActiveRecord, you can remove these lines.
begin
ActiveRecord::Migration.maintain_test_schema!
rescue ActiveRecord::PendingMigrationError => e
puts e.to_s.strip
exit 1
end
RSpec.configure do |config|
config.fixture_path = "#{::Rails.root}/spec/fixtures"
config.infer_spec_type_from_file_location!
config.filter_rails_from_backtrace!
config.use_transactional_fixtures = true
config.use_instantiated_fixtures = false
config.render_views = false
config.before(:suite) do
intro = ('-' * 80)
intro << "\n"
intro << "- Ruby: #{RUBY_VERSION}\n"
intro << "- Rails: #{Rails.version}\n"
intro << "- ActiveAdmin: #{ActiveAdmin::VERSION}\n"
intro << "- ActiveResource: #{ActiveResource::VERSION::STRING}\n"
intro << ('-' * 80)
RSpec.configuration.reporter.message(intro)
end
end