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
candlepin-api-0.4.0 bundle/ruby/1.8/gems/gherkin-2.11.1/features/step_definitions/json_formatter_steps.rb
candlepin-api-0.4.0 bundle/ruby/gems/gherkin-2.11.1/features/step_definitions/json_formatter_steps.rb
candlepin-api-0.4.0 bundle/ruby/1.9.1/gems/gherkin-2.11.1/features/step_definitions/json_formatter_steps.rb
librarian-puppet-0.9.9 vendor/gems/ruby/1.9.1/gems/gherkin-2.11.6/features/step_definitions/json_formatter_steps.rb
librarian-puppet-0.9.8 vendor/gems/ruby/1.9.1/gems/gherkin-2.11.6/features/step_definitions/json_formatter_steps.rb
gherkin-2.11.6 features/step_definitions/json_formatter_steps.rb
gherkin-2.11.6-x86-mswin32 features/step_definitions/json_formatter_steps.rb
gherkin-2.11.6-x86-mingw32 features/step_definitions/json_formatter_steps.rb
gherkin-2.11.6-java features/step_definitions/json_formatter_steps.rb
gherkin-2.11.5 features/step_definitions/json_formatter_steps.rb
gherkin-2.11.5-x86-mswin32 features/step_definitions/json_formatter_steps.rb
gherkin-2.11.5-x86-mingw32 features/step_definitions/json_formatter_steps.rb
gherkin-2.11.5-java features/step_definitions/json_formatter_steps.rb
gherkin-2.11.4 features/step_definitions/json_formatter_steps.rb
gherkin-2.11.4-x86-mswin32 features/step_definitions/json_formatter_steps.rb
gherkin-2.11.4-x86-mingw32 features/step_definitions/json_formatter_steps.rb
gherkin-2.11.4-java features/step_definitions/json_formatter_steps.rb
gherkin-2.11.3 features/step_definitions/json_formatter_steps.rb
gherkin-2.11.3-x86-mswin32 features/step_definitions/json_formatter_steps.rb
gherkin-2.11.3-x86-mingw32 features/step_definitions/json_formatter_steps.rb