Sha256: 8cd1b6ac716cd9f3f34a437fa346f3272f59c772e5c3890ee4ff3f9135a52dd3

Contents?: true

Size: 1.16 KB

Versions: 5

Compression:

Stored size: 1.16 KB

Contents

Given(/^I have stubbed $stdin to contain "(.*?)"$/) do |file|
  expect($stdin).to receive(:read).and_return(File.read(file))
end

Given(/^I have stubbed $stdin to contain nothing$/) do
  expect($stdin).to receive(:read).and_return(nil)
end

Then(/^nothing should be outputted to STDERR$/) do
  expect($stderr).to_not receive(:puts)
end

Then(/^the output should contain JSON$/) do
  @json = JSON.parse(all_stdout)
  expect(@json["validation"]).to be_present
end

Then(/^the JSON should have a state of "(.*?)"$/) do |state|
  expect(@json["validation"]["state"]).to eq(state)
end

Then(/^the JSON should have (\d+) errors?$/) do |count|
  @index = count.to_i - 1
  expect(@json["validation"]["errors"].count).to eq(count.to_i)
end

Then(/^that error should have the "(.*?)" "(.*?)"$/) do |k, v|
  expect(@json["validation"]["errors"][@index][k].to_s).to eq(v)
end

Then(/^error (\d+) should have the "(.*?)" "(.*?)"$/) do |index, k, v|
  expect(@json["validation"]["errors"][index.to_i - 1][k].to_s).to eq(v)
end

Then(/^error (\d+) should have the constraint "(.*?)" "(.*?)"$/) do |index, k, v|
  expect(@json["validation"]["errors"][index.to_i - 1]["constraints"][k].to_s).to eq(v)
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
csvlint-1.5.0 features/step_definitions/cli_steps.rb
csvlint-1.4.0 features/step_definitions/cli_steps.rb
csvlint-1.3.0 features/step_definitions/cli_steps.rb
csvlint-1.2.0 features/step_definitions/cli_steps.rb
csvlint-1.1.0 features/step_definitions/cli_steps.rb