Sha256: 59359836e8d525cf6a0c3c08a6db1a75b0dfb30bc4847a41c9d6a1061da9e830
Contents?: true
Size: 717 Bytes
Versions: 3
Compression:
Stored size: 717 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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
lopata-0.1.13 | lib/lopata/condition.rb |
lopata-0.1.12 | lib/lopata/condition.rb |
lopata-0.1.11 | lib/lopata/condition.rb |