Sha256: 05c95be1011dddb6e5f209d987d165022aef1cdca8988d7cbe60a0503f19fcc9

Contents?: true

Size: 1.35 KB

Versions: 17

Compression:

Stored size: 1.35 KB

Contents

require File.expand_path('../../test_helper', __FILE__)
require "mocha/configuration"

class ConfigurationTest < Mocha::TestCase
  def test_allow_temporarily_changes_config_when_given_block
    Mocha::Configuration.warn_when(:stubbing_method_unnecessarily)
    yielded = false
    Mocha::Configuration.allow(:stubbing_method_unnecessarily) do
      yielded = true
      assert Mocha::Configuration.allow?(:stubbing_method_unnecessarily)
    end
    assert yielded
    assert Mocha::Configuration.warn_when?(:stubbing_method_unnecessarily)
  end

  def test_prevent_temporarily_changes_config_when_given_block
    Mocha::Configuration.allow(:stubbing_method_unnecessarily)
    yielded = false
    Mocha::Configuration.prevent(:stubbing_method_unnecessarily) do
      yielded = true
      assert Mocha::Configuration.prevent?(:stubbing_method_unnecessarily)
    end
    assert yielded
    assert Mocha::Configuration.allow?(:stubbing_method_unnecessarily)
  end

  def test_warn_when_temporarily_changes_config_when_given_block
    Mocha::Configuration.allow(:stubbing_method_unnecessarily)
    yielded = false
    Mocha::Configuration.warn_when(:stubbing_method_unnecessarily) do
      yielded = true
      assert Mocha::Configuration.warn_when?(:stubbing_method_unnecessarily)
    end
    assert yielded
    assert Mocha::Configuration.allow?(:stubbing_method_unnecessarily)
  end
end

Version data entries

17 entries across 14 versions & 4 rubygems

Version Path
mocha-1.6.0 test/unit/configuration_test.rb
mocha-1.5.0 test/unit/configuration_test.rb
mocha-1.4.0 test/unit/configuration_test.rb
mocha-1.3.0 test/unit/configuration_test.rb
mocha-1.2.1 test/unit/configuration_test.rb
mocha-1.2.0 test/unit/configuration_test.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/mocha-1.0.0/test/unit/configuration_test.rb
apl-library-0.0.90 vendor/bundle/ruby/1.9.1/gems/mocha-1.0.0/test/unit/configuration_test.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/vendor/bundle/ruby/1.9.1/gems/mocha-1.0.0/test/unit/configuration_test.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/vendor/bundle/ruby/2.1.0/gems/mocha-1.0.0/test/unit/configuration_test.rb
mocha-1.1.0 test/unit/configuration_test.rb
mocha-1.0.0 test/unit/configuration_test.rb
mocha-1.0.0.alpha test/unit/configuration_test.rb
tnargav-1.3.3 vendor/bundle/ruby/1.9.1/gems/mocha-0.14.0/test/unit/configuration_test.rb
challah-1.0.0 vendor/bundle/gems/mocha-0.14.0/test/unit/configuration_test.rb
tnargav-1.2.3 vendor/bundle/ruby/1.9.1/gems/mocha-0.14.0/test/unit/configuration_test.rb
mocha-0.14.0 test/unit/configuration_test.rb