Sha256: 2a0f0d5397098e6c416435ccc8d6b7ef6d5a636f7f10b6ee21a99643605906f8

Contents?: true

Size: 905 Bytes

Versions: 15

Compression:

Stored size: 905 Bytes

Contents

require File.expand_path("#{File.dirname(__FILE__)}/test_helper")

class TestUnitIntegrationTest < Test::Unit::TestCase
  def setup
    super
    @subject = Object.new
  end

  def teardown
    super
  end

  def test_using_a_mock
    mock(@subject).foobar(1, 2) {:baz}
    assert_equal :baz, @subject.foobar(1, 2)
  end
  
  def test_using_a_stub
    stub(@subject).foobar {:baz}
    assert_equal :baz, @subject.foobar("any", "thing")
  end

  def test_using_a_mock_proxy
    def @subject.foobar
      :baz
    end

    mock.proxy(@subject).foobar
    assert_equal :baz, @subject.foobar
  end

  def test_using_a_stub_proxy
    def @subject.foobar
      :baz
    end

    stub.proxy(@subject).foobar
    assert_equal :baz, @subject.foobar
  end

  def test_times_called_verification
    mock(@subject).foobar(1, 2) {:baz}
    assert_raise RR::Errors::TimesCalledError do
      teardown
    end
  end
end

Version data entries

15 entries across 15 versions & 2 rubygems

Version Path
adva-0.3.2 test/rr/spec/rr/test_unit/test_unit_integration_test.rb
adva-0.3.1 test/rr/spec/rr/test_unit/test_unit_integration_test.rb
adva-0.3.0 test/rr/spec/rr/test_unit/test_unit_integration_test.rb
adva-0.2.4 test/rr/spec/rr/test_unit/test_unit_integration_test.rb
adva-0.2.3 test/rr/spec/rr/test_unit/test_unit_integration_test.rb
adva-0.2.2 test/rr/spec/rr/test_unit/test_unit_integration_test.rb
adva-0.2.1 test/rr/spec/rr/test_unit/test_unit_integration_test.rb
adva-0.2.0 test/rr/spec/rr/test_unit/test_unit_integration_test.rb
adva-0.1.4 test/rr/spec/rr/test_unit/test_unit_integration_test.rb
adva-0.1.3 test/rr/spec/rr/test_unit/test_unit_integration_test.rb
adva-0.1.2 test/rr/spec/rr/test_unit/test_unit_integration_test.rb
adva-0.1.1 test/rr/spec/rr/test_unit/test_unit_integration_test.rb
adva-0.1.0 test/rr/spec/rr/test_unit/test_unit_integration_test.rb
adva-0.0.1 test/rr/spec/rr/test_unit/test_unit_integration_test.rb
rr-0.6.0 spec/rr/test_unit/test_unit_integration_test.rb