Sha256: f258ebc4c56389ad9a031d2eacfaa1443cb071da7613663e2b9e60ed6742b18b

Contents?: true

Size: 783 Bytes

Versions: 6

Compression:

Stored size: 783 Bytes

Contents

require 'teststrap'

context "A nil assertion macro" do
  helper(:assert_nil) { |o| Riot::Assertion.new("foo") { o }.nil.run(Riot::Situation.new) }

  asserts(":pass when result is nil") { assert_nil(nil)       }.equals([:pass, "is nil"])
  asserts(":fail with message")       { assert_nil("a")[0..1] }.equals([:fail, %Q{expected nil, not "a"}])
end # A nil assertion macro

context "A negative nil assertion macro" do
  helper(:assert_not_nil) { |o| Riot::Assertion.new("foo", true) { o }.nil.run(Riot::Situation.new) }
  
  asserts(":pass when result is not nil") { assert_not_nil(1)         }.equals([:pass, "is nil"])
  asserts(":fail with message")           { assert_not_nil(nil)[0..1] }.equals([:fail, %Q{expected is nil, not "non-nil"}])
end # A negative nil assertion macro

Version data entries

6 entries across 6 versions & 1 rubygems

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