Sha256: 42b157b2c5adaad0f05e962fc8ca2e7f6f5df0a72a644f78a85d3d3109bb61fe
Contents?: true
Size: 669 Bytes
Versions: 99
Compression:
Stored size: 669 Bytes
Contents
require 'stringio' require 'gherkin/formatter/json_formatter' require 'gherkin/listener/formatter_listener' # Monkey patching so that Hash.to_json has a predictable result. class Hash alias orig_keys keys def keys orig_keys.sort end end Given /^a JSON formatter$/ do @out = StringIO.new @formatter = Gherkin::Formatter::JSONFormatter.new(@out) end Then /^the outputted JSON should be:$/ do |expected_json| require 'json' @formatter.done actual_json = @out.string puts actual_json puts JSON.pretty_generate(JSON.parse(actual_json)) expected = JSON.parse(expected_json) actual = JSON.parse(actual_json) actual.should == expected end
Version data entries
99 entries across 96 versions & 8 rubygems