lib/atp/flow.rb in atp-0.3.1 vs lib/atp/flow.rb in atp-0.3.2

- old
+ new

@@ -155,31 +155,31 @@ end # Returns true if the test context generated from the supplied options + existing condition # wrappers, is different from that which was applied to the previous test. def context_changed?(options) - a = context[:conditions] - b = build_context(options)[:conditions] - !conditions_equal?(a, b) + a = context + b = build_context(options) + !context_equal?(a, b) end def context builder.context end - private - - def conditions_equal?(a, b) + def context_equal?(a, b) if a.size == b.size - a = clean_condition(a) - b = clean_condition(b) + a = clean_condition(a[:conditions]) + b = clean_condition(b[:conditions]) if a.keys.sort == b.keys.sort a.all? do |key, value| value.flatten.uniq.sort == b[key].flatten.uniq.sort end end end end + + private def clean_condition(h) c = {} h.each do |hash| key, value = hash.first[0], hash.first[1]