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

Version Path
gherkin-2.7.5-x86-mswin32 features/step_definitions/json_formatter_steps.rb
gherkin-2.7.5-x86-mingw32 features/step_definitions/json_formatter_steps.rb
gherkin-2.7.5-java features/step_definitions/json_formatter_steps.rb
gherkin-2.7.4 features/step_definitions/json_formatter_steps.rb
gherkin-2.7.4-x86-mswin32 features/step_definitions/json_formatter_steps.rb
gherkin-2.7.4-x86-mingw32 features/step_definitions/json_formatter_steps.rb
gherkin-2.7.4-java features/step_definitions/json_formatter_steps.rb
gherkin-2.7.3 features/step_definitions/json_formatter_steps.rb
gherkin-2.7.3-x86-mswin32 features/step_definitions/json_formatter_steps.rb
gherkin-2.7.3-x86-mingw32 features/step_definitions/json_formatter_steps.rb
gherkin-2.7.3-java features/step_definitions/json_formatter_steps.rb
gherkin-2.7.2 features/step_definitions/json_formatter_steps.rb
gherkin-2.7.2-x86-mswin32 features/step_definitions/json_formatter_steps.rb
gherkin-2.7.2-x86-mingw32 features/step_definitions/json_formatter_steps.rb
gherkin-2.7.2-java features/step_definitions/json_formatter_steps.rb
gherkin-2.7.1 features/step_definitions/json_formatter_steps.rb
gherkin-2.7.1-x86-mswin32 features/step_definitions/json_formatter_steps.rb
gherkin-2.7.1-x86-mingw32 features/step_definitions/json_formatter_steps.rb
gherkin-2.7.1-java features/step_definitions/json_formatter_steps.rb