Sha256: 69dac6c115fbc2019851379c46cb832ca0b381ce5daece2650e66473f90b2606

Contents?: true

Size: 346 Bytes

Versions: 2

Compression:

Stored size: 346 Bytes

Contents

module Riot
  # Asserts the result is empty
  #   asserts("a string") { "" }.empty
  #   asserts("an array") { [] }.empty
  #   asserts("a hash") { Hash.new }.empty
  class EmptyMacro < AssertionMacro
    register :empty

    def evaluate(actual)
      actual.length == 0 ? pass : fail("expected #{actual.inspect} to be empty")
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
riot-0.10.11 lib/riot/assertion_macros/empty.rb
riot-0.10.10 lib/riot/assertion_macros/empty.rb