Sha256: a461db583724af775cf6b37a8e8e42a63fd75f34e745ccb125c1001506079212

Contents?: true

Size: 1.06 KB

Versions: 3

Compression:

Stored size: 1.06 KB

Contents

# frozen_string_literal: true

require "recommender"
require 'factory_bot_rails'
require "faker"
require 'database_cleaner/active_record'
ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../test_app/config/environment.rb', __FILE__)

factories_path = File.expand_path("../spec/factories/**/*.rb", __dir__)
Dir[factories_path].sort.each { |file| require file }
Dir[Rails.root.join('spec', '**', '*.rb')].sort.each { |file| require file }

RSpec.configure do |config|
  config.example_status_persistence_file_path = ".rspec_status"

  config.include FactoryBot::Syntax::Methods

  config.before(:suite) do
    FactoryBot.find_definitions
  end

  # Disable RSpec exposing methods globally on `Module` and `main`
  config.disable_monkey_patching!

  config.expect_with :rspec do |c|
    c.syntax = :expect
  end

  config.before(:suite) do
    FactoryBot.find_definitions
  end

  config.before(:each) do
    # Ensure a clean state for each test
    DatabaseCleaner.strategy = :transaction
    DatabaseCleaner.start
  end

  config.after(:each) do
    DatabaseCleaner.clean
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
recommender-2.0.1 spec/spec_helper.rb
recommender-2.0.0 spec/spec_helper.rb
recommender-0.1.0 spec/spec_helper.rb