Sha256: 5ca45cb4b983ff5021531507f6be6b0585f6ca1eff7163356715b3d53098c596

Contents?: true

Size: 897 Bytes

Versions: 12

Compression:

Stored size: 897 Bytes

Contents

dir = File.dirname(__FILE__)
require "#{dir}/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_probe
    def @subject.foobar
      :baz
    end

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

  def test_using_a_stub_probe
    def @subject.foobar
      :baz
    end

    stub.probe(@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

12 entries across 12 versions & 1 rubygems

Version Path
rr-0.3.11 examples/rr/test_unit/test_unit_integration_test.rb
rr-0.3.1 examples/rr/test_unit/test_unit_integration_test.rb
rr-0.3.4 examples/rr/test_unit/test_unit_integration_test.rb
rr-0.3.3 examples/rr/test_unit/test_unit_integration_test.rb
rr-0.3.10 examples/rr/test_unit/test_unit_integration_test.rb
rr-0.3.0 examples/rr/test_unit/test_unit_integration_test.rb
rr-0.3.2 examples/rr/test_unit/test_unit_integration_test.rb
rr-0.3.9 examples/rr/test_unit/test_unit_integration_test.rb
rr-0.3.7 examples/rr/test_unit/test_unit_integration_test.rb
rr-0.3.6 examples/rr/test_unit/test_unit_integration_test.rb
rr-0.3.5 examples/rr/test_unit/test_unit_integration_test.rb
rr-0.3.8 examples/rr/test_unit/test_unit_integration_test.rb