Sha256: db6f7e9faabc758a96b37c1eb2646c78e550e483c037cb52c54424fcbf662414
Contents?: true
Size: 878 Bytes
Versions: 10
Compression:
Stored size: 878 Bytes
Contents
module CCK class KeysChecker def self.compare(found, expected) KeysChecker.new.compare(found, expected) end def compare(found, expected) errors = [] found_keys = found.to_h(reject_nil_values: true).keys expected_keys = expected.to_h(reject_nil_values: true).keys return errors if found_keys.sort == expected_keys.sort missing_keys = (expected_keys - found_keys) extra_keys = (found_keys - expected_keys).reject { |key| ENV['CI'] && found.class == Cucumber::Messages::Meta && key == :ci } errors << "Found extra keys in message #{found.class.name}: #{extra_keys}" unless extra_keys.empty? errors << "Missing keys in message #{found.class.name}: #{missing_keys}" unless missing_keys.empty? errors rescue StandardError => e ["Unexpected error: #{e.message}"] end end end
Version data entries
10 entries across 10 versions & 1 rubygems