Sha256: a3f47475e6d5590481a1b72a51d09af55920835bf830df39c0cefca7554b07a0

Contents?: true

Size: 779 Bytes

Versions: 6

Compression:

Stored size: 779 Bytes

Contents

require "spec_helper"

describe HumansRb::Transform do
  let(:xform) { HumansRb::Transform.new }

  context "values" do
    it "transform the key/value pair values" do
      expected = { :foo => "bar" }
      expect(xform.apply({ :key => "foo", :value => "bar" })).to eq(expected)
    end

    it "merges the array of hashes into a single hash" do
      input = { :heading => "test", :values => [{ :foo => "bar"}, {:foo2 => "bar2" }] }
      expected = { :foo => "bar", :foo2 => "bar2" }
      expect(xform.apply(input)[:test]).to eq(expected)
    end
  end

  context "headings" do
    it "converts the heading" do
      input = { :heading => "test", :values => [{ :foo => "bar"}, {:foo2 => "bar2" }] }
      expect(xform.apply(input).keys.first).to eq(:test)
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
humans_rb-0.0.6 spec/humans_transform_spec.rb
humans_rb-0.0.5 spec/humans_transform_spec.rb
humans_rb-0.0.4 spec/humans_transform_spec.rb
humans_rb-0.0.3 spec/humans_transform_spec.rb
humans_rb-0.0.2 spec/humans_transform_spec.rb
humans_rb-0.0.1 spec/humans_transform_spec.rb