Sha256: dcccbda0813b82f44a7f5bb8ef2e7edcb72fabd0fc618692da617367f858c0d6

Contents?: true

Size: 488 Bytes

Versions: 2

Compression:

Stored size: 488 Bytes

Contents

module Riot
  # Asserts that the result of the test is an object that is a kind of the expected type
  #   asserts("test") { "foo" }.kind_of(String)
  #   should("test") { "foo" }.kind_of(String)
  class KindOfMacro < AssertionMacro
    register :kind_of

    def evaluate(actual, expected)
      if actual.kind_of?(expected)
        pass("is a kind of #{expected.inspect}")
      else
        fail("expected kind of #{expected}, not #{actual.class.inspect}")
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
riot-0.10.11 lib/riot/assertion_macros/kind_of.rb
riot-0.10.10 lib/riot/assertion_macros/kind_of.rb