Sha256: 9d73d763443d4629033f2c8a6bda69d07b8dd6897c0601ba4377db17099cc1dc
Contents?: true
Size: 1.28 KB
Versions: 5
Compression:
Stored size: 1.28 KB
Contents
require 'teststrap' context "A negative assertion test" do helper(:negative_assertion) do |definition| Riot::Assertion.new("foo", true) { definition } end asserts("response when evaluated with false result") do negative_assertion(false).run(Riot::Situation.new) end.equals([:pass, ""]) asserts("response when evaluated with nil result") do negative_assertion(false).run(Riot::Situation.new) end.equals([:pass, ""]) asserts("response when evaluated with true result") do negative_assertion(true).run(Riot::Situation.new) end.equals([:fail, "Expected non-true but got true instead", nil, nil]) asserts("response when evaluated with \"bar\" result") do negative_assertion("bar").run(Riot::Situation.new) end.equals([:fail, "Expected non-true but got \"bar\" instead", nil, nil]) asserts("response when evaluated with 0 result") do negative_assertion(0).run(Riot::Situation.new) end.equals([:fail, "Expected non-true but got 0 instead", nil, nil]) helper(:big_exception) { @exception ||= Exception.new("blah") } asserts("response when evaluation errors") do exception = big_exception # :\ Riot::Assertion.new("foo", true) { raise exception }.run(Riot::Situation.new) end.equals { [:error, big_exception] } end # A negative assertion test
Version data entries
5 entries across 5 versions & 1 rubygems