Sha256: 9fe8295d750dfec9ceec222c9868cf212e89df711b07dbf839c2891409c52550

Contents?: true

Size: 1.21 KB

Versions: 3

Compression:

Stored size: 1.21 KB

Contents

Given(/^I create a Itiel::Lookup::DatabaseTable object for the "(.*?)"$/) do |table_name|
  @lookup = Itiel::Lookup::DatabaseTable.new
  @lookup.connection = :test
  @lookup.table_name = table_name
end

Given(/^I create a Itiel::Lookup::CSVFile object with the "(.*?)" file$/) do |file_name|
  @lookup = Itiel::Lookup::CSVFile.new(File.join('tmp', file_name))
end

Given(/^the lookup joins the "(.*?)" column in the source with the "(.*?)" column in the lookup stream$/) do |source_column, lookup_column|
  @lookup.lookup_columns = { source_column => lookup_column }
end

Given(/^the lookup appends the "(.*?)" column on the lookup stream to the source as "(.*?)"$/) do |original_name, new_name|
  @lookup.joined_columns = { original_name => new_name }
end

Then(/^the output for the lookup should be:$/) do |table|
  result = @lookup.output
  table.hashes.each_with_index do |row, index|
    table.headers.each do |column|
      expect(result[index][column.to_sym].to_s).to eq row[column]
    end
  end
end

Given /^an? orders database table$/ do
  Itiel::Extract::CustomSQL.connection_file_path = @database_config_path

  Itiel::Extract::CustomSQL.sequel_connection(:test).create_table :orders do
    Integer :id
    String :email
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
itiel-0.1.2 features/step_definitions/lookup/lookup_steps.rb
itiel-0.1.1 features/step_definitions/lookup/lookup_steps.rb
itiel-0.1.0 features/step_definitions/lookup/lookup_steps.rb