Sha256: e8436a65f5865db93a1fc98ee51c2df5b434f5bf338888aea341649394ad4668

Contents?: true

Size: 651 Bytes

Versions: 2

Compression:

Stored size: 651 Bytes

Contents

# frozen_string_literal: true
require "active_mocker/loaded_mocks"
require "active_mocker/rspec"

RSpec.configure do |config|
  config.include ActiveMocker::Rspec

  config.before(:each, active_mocker: true) do
    unless ENV["RUN_WITH_RAILS"] && self.class.metadata[:rails_compatible]
      active_mocker.mocks.each { |class_name, mock| stub_const(class_name, mock) }
    end
    stub_const("ActiveRecord::RecordNotFound", ActiveMocker::RecordNotFound)
  end

  config.after(:all, active_mocker: true) do
    ActiveMocker::LoadedMocks.delete_all
  end

  config.before(:all, active_mocker: true) do
    ActiveMocker::LoadedMocks.delete_all
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
active_mocker-2.3.4 lib/active_mocker/rspec_helper.rb
active_mocker-2.3.3 lib/active_mocker/rspec_helper.rb