-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrails_helper.rb
More file actions
37 lines (29 loc) · 1.1 KB
/
rails_helper.rb
File metadata and controls
37 lines (29 loc) · 1.1 KB
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
# frozen_string_literal: true
# Prevent database truncation if the environment is production
abort("The Rails environment is running in production mode!") if Rails.env.production?
require "rspec/rails"
require "capybara/rails"
require "capybara-screenshot/rspec"
Dir[File.expand_path("support/**/*.rb", __dir__)].each { |f| require f }
if defined? ActiveRecord
# 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 # rubocop:disable RSpec/Output
exit 1
end
end
RSpec.configure do |config|
config.use_transactional_fixtures = true
config.infer_spec_type_from_file_location!
config.filter_rails_from_backtrace!
config.disable_monkey_patching!
config.include_context "with some data"
config.include_context "Capybara helpers"
config.before(:each, type: :feature) do
TinyAdmin.settings.reset!
TinyAdmin.configure_from_file(Rails.root.join("config/tiny_admin.yml"))
end
end