Sha256: 6705b575bf1a77efcb3d7508114d76f2443c243104eeb1d957c0a29949e5d1c5

Contents?: true

Size: 574 Bytes

Versions: 9

Compression:

Stored size: 574 Bytes

Contents

require 'test_helper'

class TestMocking < Minitest::Test
  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

9 entries across 9 versions & 1 rubygems

Version Path
spy-1.0.5 test/integration/test_mocking.rb
spy-1.0.4 test/integration/test_mocking.rb
spy-1.0.3 test/integration/test_mocking.rb
spy-1.0.2 test/integration/test_mocking.rb
spy-1.0.1 test/integration/test_mocking.rb
spy-1.0.0 test/integration/test_mocking.rb
spy-0.4.5 test/integration/test_mocking.rb
spy-0.4.3 test/integration/test_mocking.rb
spy-0.4.2 test/integration/test_mocking.rb