Sha256: 202112a1d0970f2c3bb1eda1ad22f83ddea4ec0403c204489942a9e007db9f86

Contents?: true

Size: 491 Bytes

Versions: 2

Compression:

Stored size: 491 Bytes

Contents

module Riot
  # Asserts that the result of the test is an object that responds to the given method
  #   asserts("test") { "foo" }.respond_to(:to_s)
  #   should("test") { "foo" }.respond_to(:to_s)
  class RespondToMacro < AssertionMacro
    register :respond_to

    def evaluate(actual, expected)
      if actual.respond_to?(expected)
        pass("responds to #{expected.inspect}")
      else
        fail("expected method #{expected.inspect} is not defined")
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

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