Sha256: f56dfcf8d6404b83c11fea2a715bed42ff4ef0d7d65e792be15866d412cb8b9f

Contents?: true

Size: 1 KB

Versions: 15

Compression:

Stored size: 1 KB

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
    if (mapping = active_mocker.features[:stub_active_record_exceptions])
      mapping.each { |class_name, mock| stub_const(class_name, mock) }
    end
  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

  config.after(:each, active_mocker: true) do
    ActiveMocker::LoadedMocks.delete_all if active_mocker.features[:delete_all_before_example]
  end

  config.before(:each, active_mocker: true) do
    ActiveMocker::LoadedMocks.delete_all if active_mocker.features[:delete_all_before_example]
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
active_mocker-2.6.2 lib/active_mocker/rspec_helper.rb
active_mocker-2.6.1.beta2 lib/active_mocker/rspec_helper.rb
active_mocker-2.6.1.beta lib/active_mocker/rspec_helper.rb
active_mocker-2.6.0 lib/active_mocker/rspec_helper.rb
active_mocker-2.5.4 lib/active_mocker/rspec_helper.rb
active_mocker-2.5.3 lib/active_mocker/rspec_helper.rb
active_mocker-2.5.2 lib/active_mocker/rspec_helper.rb
active_mocker-2.5.1 lib/active_mocker/rspec_helper.rb
active_mocker-2.5.1.pre lib/active_mocker/rspec_helper.rb
active_mocker-2.5.0 lib/active_mocker/rspec_helper.rb
active_mocker-2.4.4 lib/active_mocker/rspec_helper.rb
active_mocker-2.4.3 lib/active_mocker/rspec_helper.rb
active_mocker-2.4.2 lib/active_mocker/rspec_helper.rb
active_mocker-2.4.1 lib/active_mocker/rspec_helper.rb
active_mocker-2.4.0 lib/active_mocker/rspec_helper.rb