Sha256: 9d8e5a8ae943b7a00069f5056fae65ba2fe91d385b73ac06f98db7555277859c

Contents?: true

Size: 550 Bytes

Versions: 3

Compression:

Stored size: 550 Bytes

Contents

require 'test_helper'

class TestClassMethod < Minitest::Test
  def teardown
    Spy::Agency.instance.dissolve!
  end

  def test_and_return
    klass = Class.new do
      def self.class_method(*args, &block)
      end
    end
    received_args = nil
    received_block = nil
    Spy.on(klass, :class_method).and_return do |*args, &block|
      received_args = args
      received_block = block
    end
    block = -> {}
    klass.class_method(:a, :b, &block)
    assert_equal [:a, :b], received_args
    assert_equal block, received_block
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
spy-1.0.5 test/integration/test_class_method.rb
spy-1.0.4 test/integration/test_class_method.rb
spy-1.0.3 test/integration/test_class_method.rb