Sha256: b75f07090f4ee189f0ef563e650144c5580b503cf28a463e78a614c75cb93703

Contents?: true

Size: 698 Bytes

Versions: 23

Compression:

Stored size: 698 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 'multi_json'
  @formatter.done
  actual_json = @out.string
  puts actual_json
  puts MultiJson.dump(MultiJson.load(actual_json), :pretty => true)
  expected = MultiJson.load(expected_json)
  actual   = MultiJson.load(actual_json)
  actual.should == expected
end



Version data entries

23 entries across 21 versions & 2 rubygems

Version Path
honeybadger-2.4.0 vendor/gems/ruby/1.9.1/gems/gherkin-2.12.2/features/step_definitions/json_formatter_steps.rb
honeybadger-2.4.0 vendor/gems/ruby/2.2.0/gems/gherkin-2.12.2/features/step_definitions/json_formatter_steps.rb
honeybadger-2.4.0 vendor/gems/ruby/2.1.0/gems/gherkin-2.12.2/features/step_definitions/json_formatter_steps.rb
gherkin-2.12.2 features/step_definitions/json_formatter_steps.rb
gherkin-2.12.2-x86-mswin32 features/step_definitions/json_formatter_steps.rb
gherkin-2.12.2-x86-mingw32 features/step_definitions/json_formatter_steps.rb
gherkin-2.12.2-java features/step_definitions/json_formatter_steps.rb
gherkin-2.12.1 features/step_definitions/json_formatter_steps.rb
gherkin-2.12.1-x86-mswin32 features/step_definitions/json_formatter_steps.rb
gherkin-2.12.1-x86-mingw32 features/step_definitions/json_formatter_steps.rb
gherkin-2.12.1-java features/step_definitions/json_formatter_steps.rb
gherkin-2.12.0 features/step_definitions/json_formatter_steps.rb
gherkin-2.12.0-x86-mingw32 features/step_definitions/json_formatter_steps.rb
gherkin-2.12.0-x86-mswin32 features/step_definitions/json_formatter_steps.rb
gherkin-2.12.0-java features/step_definitions/json_formatter_steps.rb
gherkin-2.11.8 features/step_definitions/json_formatter_steps.rb
gherkin-2.11.8-x86-mswin32 features/step_definitions/json_formatter_steps.rb
gherkin-2.11.8-x86-mingw32 features/step_definitions/json_formatter_steps.rb
gherkin-2.11.8-java features/step_definitions/json_formatter_steps.rb
gherkin-2.11.7 features/step_definitions/json_formatter_steps.rb