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.9.1-x86-mingw32 features/step_definitions/json_formatter_steps.rb
gherkin-2.9.1-java features/step_definitions/json_formatter_steps.rb
radiant-1.0.0 ruby-debug/ruby/1.8/gems/gherkin-2.9.0/features/step_definitions/json_formatter_steps.rb
gherkin-2.9.0 features/step_definitions/json_formatter_steps.rb
gherkin-2.9.0-x86-mswin32 features/step_definitions/json_formatter_steps.rb
gherkin-2.9.0-x86-mingw32 features/step_definitions/json_formatter_steps.rb
gherkin-2.9.0-java features/step_definitions/json_formatter_steps.rb
gherkin-2.8.0 features/step_definitions/json_formatter_steps.rb
gherkin-2.8.0-x86-mswin32 features/step_definitions/json_formatter_steps.rb
gherkin-2.8.0-x86-mingw32 features/step_definitions/json_formatter_steps.rb
gherkin-2.8.0-java features/step_definitions/json_formatter_steps.rb
gherkin-2.7.7 features/step_definitions/json_formatter_steps.rb
gherkin-2.7.7-x86-mswin32 features/step_definitions/json_formatter_steps.rb
gherkin-2.7.7-x86-mingw32 features/step_definitions/json_formatter_steps.rb
gherkin-2.7.7-java features/step_definitions/json_formatter_steps.rb
gherkin-2.7.6 features/step_definitions/json_formatter_steps.rb
gherkin-2.7.6-x86-mswin32 features/step_definitions/json_formatter_steps.rb
gherkin-2.7.6-x86-mingw32 features/step_definitions/json_formatter_steps.rb
gherkin-2.7.6-java features/step_definitions/json_formatter_steps.rb
gherkin-2.7.5 features/step_definitions/json_formatter_steps.rb