Sha256: d75ba92e8ab267e30b21c6eae4505fc506d6ada42337b960d3d65532582e7c87

Contents?: true

Size: 323 Bytes

Versions: 10

Compression:

Stored size: 323 Bytes

Contents

module Riot
  # Asserts the result has items
  #   asserts("an array") { [1] }.any
  #   asserts("a hash") { {:name => 'washington'} }.any
  class AnyMacro < AssertionMacro
    register :any

    def evaluate(actual)
      actual.any? ? pass("is not empty") : fail(expected_message(actual).to_have_items)
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

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