Sha256: 0d8ae3a064a3ade36774bd7685d370a79e9ead2a65b601aaaf869a61bd1ea188

Contents?: true

Size: 661 Bytes

Versions: 16

Compression:

Stored size: 661 Bytes

Contents

require 'active_mocker/loaded_mocks'

RSpec.configure do |config|

  def mock_class(class_name)
    return class_name.constantize if defined?(Rails) && !self.class.metadata[:active_mocker]
    ActiveMocker::LoadedMocks.class_name_to_mock.select { |name, mock| name == class_name }.values.first
  end

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

  config.after(:all) do
    ActiveMocker::LoadedMocks.clear_all if self.class.metadata[:active_mocker]
  end

end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
active_mocker-1.8.4 lib/active_mocker/rspec_helper.rb
active_mocker-1.8.3 lib/active_mocker/rspec_helper.rb
active_mocker-1.8.2 lib/active_mocker/rspec_helper.rb
active_mocker-1.8.1 lib/active_mocker/rspec_helper.rb
active_mocker-1.8 lib/active_mocker/rspec_helper.rb
active_mocker-1.7.3 lib/active_mocker/rspec_helper.rb
active_mocker-1.7.2 lib/active_mocker/rspec_helper.rb
active_mocker-1.7.1 lib/active_mocker/rspec_helper.rb
active_mocker-1.7.1rc lib/active_mocker/rspec_helper.rb
active_mocker-1.7 lib/active_mocker/rspec_helper.rb
active_mocker-1.7rc2 lib/active_mocker/rspec_helper.rb
active_mocker-1.7.beta3 lib/active_mocker/rspec_helper.rb
active_mocker-1.7.beta2 lib/active_mocker/rspec_helper.rb
active_mocker-1.6.4 lib/active_mocker/rspec_helper.rb
active_mocker-1.7.beta1 lib/active_mocker/rspec_helper.rb
active_mocker-1.6.3 lib/active_mocker/rspec_helper.rb