Sha256: 42c97cbcdb92d2453f22499726223cafa99d37d1fb5b60c1bf5268148b7f63c0

Contents?: true

Size: 1.19 KB

Versions: 3

Compression:

Stored size: 1.19 KB

Contents

require 'teststrap'

context "A same_elements assertion macro" do
  setup { Riot::Assertion.new("test") { ["foo", "bar", 69] } }

  assertion_test_passes(%Q{when [69, "foo", "bar"] are returned}) do
    topic.same_elements([69, "foo", "bar"])
  end

  assertion_test_passes(%Q{when [69, "foo", "bar"] are returned in any order}) do
    topic.same_elements(["foo", "bar", 69])
  end

  assertion_test_fails("when elements do not match", %Q{expected elements ["foo", "bar", 96] to match ["foo", "bar", 69]}) do
    topic.same_elements(["foo", "bar", 96])
  end
end # A same_elements assertion macro

context "A negative same_elements assertion macro" do
  setup { Riot::Assertion.new("test", true) { ["foo","bar", 69] } }
  
  assertion_test_fails("when elements match", %Q{expected elements [69, "foo", "bar"] not to match ["foo", "bar", 69]}) do
    topic.same_elements([69, "foo", "bar"])
  end

  assertion_test_fails("when any elements match", %Q{expected elements ["foo", "bar", 69] not to match ["foo", "bar", 69]}) do
    topic.same_elements(["foo", "bar", 69])
  end

  assertion_test_passes("when elements do not match") do
    topic.same_elements(["foo", "bar", 96])
  end
  
end # A negative same_elements macro

Version data entries

3 entries across 3 versions & 1 rubygems

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