mirror of
https://github.com/Freika/dawarich.git
synced 2026-01-11 01:31:39 -05:00
38 lines
1.1 KiB
Ruby
38 lines
1.1 KiB
Ruby
require 'spec_helper'
|
|
ENV['RAILS_ENV'] ||= 'test'
|
|
require_relative '../config/environment'
|
|
|
|
abort('The Rails environment is running in production mode!') if Rails.env.production?
|
|
require 'rspec/rails'
|
|
# Add additional requires below this line. Rails is not loaded until this point!
|
|
|
|
Dir[Rails.root.join('spec', 'support', '**', '*.rb')].sort.each { |f| require f }
|
|
|
|
# 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.use_transactional_fixtures = true
|
|
config.infer_spec_type_from_file_location!
|
|
config.filter_rails_from_backtrace!
|
|
|
|
config.include FactoryBot::Syntax::Methods
|
|
config.include Devise::Test::IntegrationHelpers, type: :request
|
|
|
|
config.before do
|
|
ActiveJob::Base.queue_adapter = :test
|
|
end
|
|
end
|
|
|
|
Shoulda::Matchers.configure do |config|
|
|
config.integrate do |with|
|
|
with.test_framework :rspec
|
|
with.library :rails
|
|
end
|
|
end
|