Sha256: 3edc2ce1875508f43329c46b5ed1360fcca6ef89e392be2209308a26c188cc00

Contents?: true

Size: 1.16 KB

Versions: 4

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

4 entries across 4 versions & 1 rubygems

Version Path
csvlint-1.0.0 features/step_definitions/cli_steps.rb
csvlint-0.4.0 features/step_definitions/cli_steps.rb
csvlint-0.3.3 features/step_definitions/cli_steps.rb
csvlint-0.3.2 features/step_definitions/cli_steps.rb