Sha256: 4a89f65be5ae338718a8a233d4a935184118276ad2c4633337de0fceaa089f27

Contents?: true

Size: 1.29 KB

Versions: 1

Compression:

Stored size: 1.29 KB

Contents

ENV["HISTORIOGRAPHER_ENV"] = "test"
ENV["RAILS_ENV"] = "test"

require_relative "../init.rb"
require "ostruct"
require "factory_bot"

FactoryBot.definition_file_paths = %w{./factories ./spec/factories}
FactoryBot.find_definitions

RSpec.configure do |config|
  config.expect_with :rspec do |expectations|
    expectations.include_chain_clauses_in_custom_matcher_descriptions = true
  end

  config.mock_with :rspec do |mocks|
    mocks.verify_partial_doubles = true
  end

  config.filter_run :focus
  config.run_all_when_everything_filtered = true

  config.example_status_persistence_file_path = "spec/examples.txt"

  if config.files_to_run.one?
    config.default_formatter = 'doc'
  end

  config.profile_examples = 10

  config.order = :random

  Kernel.srand config.seed

  config.before(:suite) do
    DatabaseCleaner.strategy = :transaction
    DatabaseCleaner.clean_with(:truncation)
    ActiveRecord::Migration.maintain_test_schema!
  end

  config.around(:each) do |example|
    DatabaseCleaner.strategy = :transaction
    DatabaseCleaner.start
    example.run
    DatabaseCleaner.clean
    DatabaseCleaner.clean_with(:truncation)
  end

  config.before(:each, :logsql) do
    ActiveRecord::Base.logger = Logger.new(STDOUT)
  end

  config.after(:each, :logsql) do
    ActiveRecord::Base.logger = nil
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
historiographer-4.1.0 /Users/brettshollenberger/programming/historiographer/spec/spec_helper.rb