Sha256: e0aab43a9a061f9e3d7f42890b25fc9e3b9ec4bae173716207f0a99ceecaac34

Contents?: true

Size: 1.23 KB

Versions: 2

Compression:

Stored size: 1.23 KB

Contents

Given(/^it is encoded as "(.*?)"$/) do |encoding|
  @csv = @csv.encode(encoding)
  @encoding = encoding
end

Given(/^I set an encoding header of "(.*?)"$/) do |encoding|
  @encoding = encoding
end

Given(/^I do not set an encoding header$/) do
  @encoding = nil
end

Given(/^I have a CSV file called "(.*?)"$/) do |filename|
  @csv = File.read( File.join( File.dirname(__FILE__), "..", "fixtures", filename ) )
end

When(/^I ask if there are warnings$/) do
  @csv_options ||= default_csv_options
  if @schema_json
    @schema = Csvlint::Schema.from_json_table( @schema_url || "http://example.org ", JSON.parse(@schema_json) )
  end

  @validator = Csvlint::Validator.new( @url, @csv_options, @schema ) 
  @warnings = @validator.warnings
end

Then(/^there should be (\d+) warnings$/) do |count|
  @warnings.count.should == count.to_i
end

Given(/^the content type is set to "(.*?)"$/) do |type|
  @content_type = type
end

Then(/^that warning should have the row "(.*?)"$/) do |row|
  @warnings.first.row.should == row.to_i
end

Then(/^that warning should have the column "(.*?)"$/) do |column|
  @warnings.first.column.should == column.to_i
end

Then(/^that warning should have the type "(.*?)"$/) do |type|
  @warnings.first.type.should == type.to_sym
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
csvlint-0.1.0 features/step_definitions/validation_warnings_steps.rb
csvlint-0.0.1 features/step_definitions/validation_warnings_steps.rb