Sha256: 3f5621741f111714fe71b5227559f58d648f02c1d11eecb2f81cf3d2c20b732b

Contents?: true

Size: 1020 Bytes

Versions: 3

Compression:

Stored size: 1020 Bytes

Contents

require File.join(File.dirname(__FILE__), "..", "test_helper")
require 'stubba_replacer'
require 'mocha/mock'

require 'stubba/test_case'

class TestCaseTest < Test::Unit::TestCase
  
  include Mocha
  
  def test_should_instantiate_new_stubba
    test_class = Class.new(Test::Unit::TestCase) { def test_me; end }
    test = test_class.new(:test_me)
    replace_stubba(nil) do
      test.setup
      assert $stubba.is_a?(Stubba::Stubba)
    end
  end

  def test_should_unstub_all_stubbed_methods
    test_class = Class.new(Test::Unit::TestCase) { def test_me; end }
    test = test_class.new(:test_me)
    stubba = Mock.new(:unstub_all => nil)
    replace_stubba(stubba) do
      test.teardown
    end
    stubba.verify(:unstub_all)
  end

  def test_should_set_stubba_to_nil
    test_class = Class.new(Test::Unit::TestCase) { def test_me; end }
    test = test_class.new(:test_me)
    stubba = Mock.new(:unstub_all => nil)
    replace_stubba(stubba) do
      test.teardown
      assert_nil $stubba
    end
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mocha-0.1 test/stubba/test_case_test.rb
mocha-0.1.1 test/stubba/test_case_test.rb
mocha-0.1.2 test/stubba/test_case_test.rb