Sha256: e0c64f20fb672c365c180098e9be0abd0900894bb5ad9eb92df309de00352649

Contents?: true

Size: 1.57 KB

Versions: 14

Compression:

Stored size: 1.57 KB

Contents

Given(/^I have a CSV with the following content:$/) do |string|
  @csv = string.to_s
end

Given(/^it has a Link header holding "(.*?)"$/) do |link|
  @link = "#{link}; type=\"application/csvm+json\""
end

Given(/^it is stored at the url "(.*?)"$/) do |url|
  @url = url
  content_type = @content_type || "text/csv"
  charset = @encoding || "UTF-8"
  headers = {"Content-Type" => "#{content_type}; charset=#{charset}"}
  headers["Link"] = @link if @link
  stub_request(:get, url).to_return(:status => 200, :body => @csv, :headers => headers)
  stub_request(:get, URI.join(url, '/.well-known/csvm')).to_return(:status => 404)
  stub_request(:get, url + '-metadata.json').to_return(:status => 404)
  stub_request(:get, URI.join(url, 'csv-metadata.json')).to_return(:status => 404)
end

Given(/^it is stored at the url "(.*?)" with no character set$/) do |url|
  @url = url
  content_type = @content_type || "text/csv"
  stub_request(:get, url).to_return(:status => 200, :body => @csv, :headers => {"Content-Type" => "#{content_type}"})
  stub_request(:get, URI.join(url, '/.well-known/csvm')).to_return(:status => 404)
  stub_request(:get, url + '-metadata.json').to_return(:status => 404)
  stub_request(:get, URI.join(url, 'csv-metadata.json')).to_return(:status => 404)
end

When(/^I ask if the CSV is valid$/) do
  @csv_options ||= default_csv_options
  @validator = Csvlint::Validator.new( @url, @csv_options )
  @valid = @validator.valid?
end

Then(/^I should get the value of true$/) do
  expect( @valid ).to be(true)
end

Then(/^I should get the value of false$/) do
  expect( @valid ).to be(false)
end

Version data entries

14 entries across 14 versions & 3 rubygems

Version Path
csvlint-1.0.0 features/step_definitions/parse_csv_steps.rb
csvlint-0.4.0 features/step_definitions/parse_csv_steps.rb
csvlint-0.3.3 features/step_definitions/parse_csv_steps.rb
csvlint-0.3.2 features/step_definitions/parse_csv_steps.rb
csvlint-0.3.1 features/step_definitions/parse_csv_steps.rb
csvlint-0.3.0 features/step_definitions/parse_csv_steps.rb
wjordan213-csvlint-0.2.8 features/step_definitions/parse_csv_steps.rb
wjordan213.csvlint-0.2.8 features/step_definitions/parse_csv_steps.rb
csvlint-0.2.6 features/step_definitions/parse_csv_steps.rb
csvlint-0.2.5 features/step_definitions/parse_csv_steps.rb
csvlint-0.2.4 features/step_definitions/parse_csv_steps.rb
csvlint-0.2.2 features/step_definitions/parse_csv_steps.rb
csvlint-0.2.1 features/step_definitions/parse_csv_steps.rb
csvlint-0.2.0 features/step_definitions/parse_csv_steps.rb