Sha256: b2a62adf0b5f0a0674742239d263c7d39af1b854a702ae19131ca49f16f603a2

Contents?: true

Size: 1.77 KB

Versions: 14

Compression:

Stored size: 1.77 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
    if @schema_type == :json_table
      @schema = Csvlint::Schema.from_json_table( @schema_url || "http://example.org ", JSON.parse(@schema_json) )
    else
      @schema = Csvlint::Schema.from_csvw_metadata( @schema_url || "http://example.org ", JSON.parse(@schema_json) )
    end
  end

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

Then(/^there should be warnings$/) do
  expect( @warnings.count ).to be > 0
end

Then(/^there should not be warnings$/) do
  # this test is only used for CSVW testing, and :inconsistent_values warnings don't count in CSVW
  @warnings.delete_if { |w| [:inconsistent_values, :check_options].include?(w.type) }
  expect( @warnings.count ).to eq(0)
end

Then(/^there should be (\d+) warnings$/) do |count|
  expect( @warnings.count ).to eq( 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|
  expect( @warnings.first.row ).to eq( row.to_i )
end

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

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

Version data entries

14 entries across 14 versions & 3 rubygems

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