Sha256: a10bbebb26e34669c155cf69a14470d7b12fec7cd3c425a2bac312aba12c7ea3
Contents?: true
Size: 1.06 KB
Versions: 3
Compression:
Stored size: 1.06 KB
Contents
require 'teststrap' context "An exists assertion macro" do helper(:assert_exists) do |o| Riot::Assertion.new("test") { o }.exists.run(Riot::Situation.new) end asserts(":pass when result has a value") do assert_exists("foo") end.equals([:pass, "is not nil"]) asserts(":pass because empty string is considered a value") do assert_exists("") end.equals([:pass, "is not nil"]) asserts(":fail with message when value is nil") do assert_exists(nil)[0..1] end.equals([:fail, "expected a non-nil value"]) end # An exists assertion macro context "A negative exists assertion macro" do helper(:assert_exists) do |o| Riot::Assertion.new("test", true) { o }.exists.run(Riot::Situation.new) end asserts(":fail when string") do assert_exists("foo")[0..1] end.equals([:fail, "expected a nil value"]) asserts ":fail when string empty" do assert_exists("")[0..1] end.equals([:fail, "expected a nil value"]) asserts(":pass when nil") do assert_exists(nil) end.equals([:pass, "is nil"]) end # A negative exists assertion macro
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
riot-0.12.1 | test/core/assertion_macros/exists_test.rb |
riot-0.12.0 | test/core/assertion_macros/exists_test.rb |
riot-0.12.0.pre | test/core/assertion_macros/exists_test.rb |