Sha256: 1a5b9b0619ee9726a7f8a1f3defd0248281669e37b30615c34e6bc2207b944fc
Contents?: true
Size: 687 Bytes
Versions: 5
Compression:
Stored size: 687 Bytes
Contents
module Lopata # @private class Condition attr_reader :condition, :positive def initialize(condition, positive: true) @condition, @positive = condition, positive end alias positive? positive def match?(scenario) matched = match_metadata?(scenario) positive? ? matched : !matched end def match_metadata?(scenario) metadata = scenario.metadata case condition when Hash condition.keys.all? { |k| metadata[k] == condition[k] } when Array condition.map { |key| metadata[key] }.all? when TrueClass, FalseClass condition else metadata[condition] end end end end
Version data entries
5 entries across 5 versions & 1 rubygems