Sha256: c8e709a417d6b4926ffad4f21d99b3b73f26befe4eec92736f5c3f4c0f1b8d3e

Contents?: true

Size: 1010 Bytes

Versions: 6

Compression:

Stored size: 1010 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", "responds to :goofballs") do
    topic.respond_to(:goofballs)
  end
  
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
riot-0.12.7 test/core/assertion_macros/respond_to_test.rb
riot-0.12.6 test/core/assertion_macros/respond_to_test.rb
riot-0.12.5 test/core/assertion_macros/respond_to_test.rb
riot-0.12.4 test/core/assertion_macros/respond_to_test.rb
riot-0.12.3 test/core/assertion_macros/respond_to_test.rb
riot-0.12.2 test/core/assertion_macros/respond_to_test.rb