Sha256: 4c6d80cf07eda89192dcc81eaf5fd92e77809391451c5efda51512c969d60dbc

Contents?: true

Size: 796 Bytes

Versions: 1

Compression:

Stored size: 796 Bytes

Contents

Given(/the following JSON schema:$/) do |schema|
  @schema = schema
end

When(/^I run the JSON data generator$/) do
  @output = JsonTestData.generate!(@schema)
end

Then(/^the JSON output should be:$/) do |json|
  expect(@output).to eq json
end

Then(/^the "([^" ]*)" property of the JSON output should be a ([^ ]*)$/) do |prop, type|
  klass = Class.const_get(type)
  expect(JSON.parse(@output).fetch(prop).class).to eql klass
end

Then(/^the "([^"]*)" property of the JSON output should be a string of length (\d+)$/) do |prop, length|
  expect(JSON.parse(@output).fetch(prop).class).to eql String
  expect(JSON.parse(@output).fetch(prop).length).to eql length.to_i
end

Then(/^JSON output should have (\d+) properties$/) do |number|
  expect(JSON.parse(@output).length).to eql number.to_i
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
json_test_data-0.3.0.beta features/step_definitions/json_test_data_steps.rb