Sha256: 27c097283fb0697a9a3dba6e4e65ecfe9942af7599772b6607db53b480159e22

Contents?: true

Size: 834 Bytes

Versions: 4

Compression:

Stored size: 834 Bytes

Contents

module AdapterTests
  def test_using_a_mock
    subject = Object.new
    mock(subject).foobar(1, 2) { :baz }
    assert_equal :baz, subject.foobar(1, 2)
  end

  def test_using_a_stub
    subject = Object.new
    stub(subject).foobar { :baz }
    assert_equal :baz, subject.foobar("any", "thing")
  end

  def test_using_a_mock_proxy
    subject = Object.new
    def subject.foobar; :baz; end

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

  def test_using_a_stub_proxy
    subject = Object.new
    def subject.foobar; :baz; end

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

  def test_times_called_verification
    subject = Object.new
    mock(subject).foobar(1, 2) { :baz }
    assert_raise RR::Errors.error_class(:TimesCalledError) do
      RR.verify
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rr-1.1.0 spec/suites/common/adapter_tests.rb
rr-1.1.0.rc3 spec/suites/common/adapter_tests.rb
rr-1.1.0.rc2 spec/suites/common/adapter_tests.rb
rr-1.1.0.rc1 spec/suites/common/adapter_tests.rb