Sha256: 1cd834f570fcbbbfef563004118ed5a29c3c89670ca73f0e14210e4fe0b38a7d

Contents?: true

Size: 897 Bytes

Versions: 11

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_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

11 entries across 11 versions & 1 rubygems

Version Path
rr-0.4.6 spec/rr/test_unit/test_unit_integration_test.rb
rr-0.4.2 spec/rr/test_unit/test_unit_integration_test.rb
rr-0.4.1 spec/rr/test_unit/test_unit_integration_test.rb
rr-0.4.3 spec/rr/test_unit/test_unit_integration_test.rb
rr-0.4.9 spec/rr/test_unit/test_unit_integration_test.rb
rr-0.4.10 spec/rr/test_unit/test_unit_integration_test.rb
rr-0.4.8 spec/rr/test_unit/test_unit_integration_test.rb
rr-0.4.5 spec/rr/test_unit/test_unit_integration_test.rb
rr-0.4.0 spec/rr/test_unit/test_unit_integration_test.rb
rr-0.4.7 spec/rr/test_unit/test_unit_integration_test.rb
rr-0.4.4 spec/rr/test_unit/test_unit_integration_test.rb