Sha256: c3f5e184ac7f7a54ce4fd1a5b0001bbbbec2c03a1992e6f7e7040cc6a301c257

Contents?: true

Size: 547 Bytes

Versions: 3

Compression:

Stored size: 547 Bytes

Contents

require 'spec_helper'

describe Itiel::Transform::MapValues do
  before :each do
    @input = [
      { "id" => 1 , "active" => true  } ,
      { "id" => 2 , "active" => false }
    ]

    @output = [
      { "id" => 1 , "active" => "yes" } ,
      { "id" => 2 , "active" => "no"  }
    ]

    @transformation = Itiel::Transform::MapValues.new(
      {
        "active" => { true => "yes", false => "no" }
      }
    )
  end

  it "maps a column depending on it's value" do
    expect(@output).to eq @transformation.transform!(@input)
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
itiel-0.1.2 spec/transform/map_values_spec.rb
itiel-0.1.1 spec/transform/map_values_spec.rb
itiel-0.1.0 spec/transform/map_values_spec.rb