Sha256: 62ddcc88397699e0244ef35690641fb3ee27664b57ded6c15e53242e5a207a8d

Contents?: true

Size: 584 Bytes

Versions: 4

Compression:

Stored size: 584 Bytes

Contents

require 'test_helper'

class TestMocking < MiniTest::Unit::TestCase
  def teardown
    Spy::Agency.instance.dissolve!
  end

  def test_spy_on_mock_does_not_raise
    mock = Spy.mock(Pen)
    spy = Spy.on(mock, :write).and_return(:awesome)
    assert_equal :awesome, mock.write("hello")
    assert spy.has_been_called?
  end

  def test_spy_mock_shortcuts
    mock = Spy.mock(Pen, :another, write_hello: :goodbye)
    assert_nil mock.another
    assert_equal :goodbye, mock.write_hello
  end

  def test_spy_mock_all
    mock = Spy.mock_all(Pen)
    assert_nil mock.another
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
spy-0.4.1 test/integration/test_mocking.rb
spy-0.4.0 test/integration/test_mocking.rb
spy-0.3.1 test/integration/test_mocking.rb
spy-0.3.0 test/integration/test_mocking.rb