Sha256: 6608847412072d6208647bf5f9d2776d080907a21c54e3e7d8c268b55aeb962c

Contents?: true

Size: 524 Bytes

Versions: 12

Compression:

Stored size: 524 Bytes

Contents

module Riot
  # Asserts that the result of the test is a non-nil value. This is useful in the case where you don't want
  # to translate the result of the test into a boolean value
  #   asserts("test") { "foo" }.exists
  #   should("test") { 123 }.exists
  #   asserts("test") { "" }.exists
  #   asserts("test") { nil }.exists # This would fail
  class ExistsMacro < AssertionMacro
    register :exists

    def evaluate(actual)
      !actual.nil? ? pass("is not nil") : fail("expected a non-nil value")
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
riot-0.11.4 lib/riot/assertion_macros/exists.rb
riot-0.11.4.pre lib/riot/assertion_macros/exists.rb
riot-0.11.3 lib/riot/assertion_macros/exists.rb
riot-0.11.2 lib/riot/assertion_macros/exists.rb
riot-0.11.1 lib/riot/assertion_macros/exists.rb
riot-0.11.0 lib/riot/assertion_macros/exists.rb
riot-0.10.13 lib/riot/assertion_macros/exists.rb
riot-0.10.13.pre lib/riot/assertion_macros/exists.rb
riot-0.10.12 lib/riot/assertion_macros/exists.rb
riot-0.10.12.pre lib/riot/assertion_macros/exists.rb
riot-0.10.11 lib/riot/assertion_macros/exists.rb
riot-0.10.10 lib/riot/assertion_macros/exists.rb