Sha256: 5bcf8d1c446cf501c1061a6d2b0b70636712281ff1d2bdac403937dd5c64a55b

Contents?: true

Size: 727 Bytes

Versions: 3

Compression:

Stored size: 727 Bytes

Contents

require 'teststrap'

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

  assertion_test_passes("when expression matches actual", %Q{matches /abc/}) { topic.matches(/abc/) }

  assertion_test_fails("when expression fails to match", "expected /abcd/ to match \"abc\"") do
    topic.matches(/abcd/)
  end

  context "with integer based topic" do
    setup { Riot::Assertion.new("foo") { 42 } }

    assertion_test_passes("actual value converted to string", %Q{matches /^42$/}) do
      topic.matches(/^42$/)
    end

    assertion_test_fails("actual value converted to string", %Q{expected /^52$/ to match 42}) do
      topic.matches(/^52$/)
    end
  end

end # A matching assertion macro

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
riot-0.11.4 test/core/assertion_macros/matching_test.rb
riot-0.11.4.pre test/core/assertion_macros/matching_test.rb
riot-0.11.3 test/core/assertion_macros/matching_test.rb