Sha256: b4683c17093e6a2391183fab3214329b666d7a94e5c7362cedc72f10380dd567

Contents?: true

Size: 1017 Bytes

Versions: 3

Compression:

Stored size: 1017 Bytes

Contents

require 'teststrap'

context "A respond_to assertion macro" do
  setup { Riot::Assertion.new("foo") { "bar" } }

  assertion_test_passes("when method is defined", "responds to :each_byte") { topic.respond_to(:each_byte) }
  assertion_test_passes("using responds_to alias", "responds to :length")   { topic.responds_to(:length)   }

  assertion_test_fails("when method not defined", "expected method :goofballs is not defined") do
    topic.respond_to(:goofballs)
  end

end # A respond_to assertion macro

context "A negative respond_to assertion macro" do
  setup { Riot::Assertion.new("foo", true) { "bar" } }
  
  assertion_test_fails("when method is defined", "expected method :each_byte is defined") do
    topic.respond_to(:each_byte)
  end
  
  assertion_test_fails("using responds_to alias", "expected method :length is defined") do
    topic.responds_to(:length)
  end
  
  assertion_test_passes("when method is not defined", "does not respond to :goofballs") do
    topic.respond_to(:goofballs)
  end
  
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
riot-0.12.1 test/core/assertion_macros/respond_to_test.rb
riot-0.12.0 test/core/assertion_macros/respond_to_test.rb
riot-0.12.0.pre test/core/assertion_macros/respond_to_test.rb