Sha256: 5e2f6c32c039d105519b626363defdd7824a0cebb01f07354603eeb7774aa395

Contents?: true

Size: 646 Bytes

Versions: 4

Compression:

Stored size: 646 Bytes

Contents

require 'spec_helper'
module Alf
  describe "Support#to_tuple" do

    let(:expected){
      Tuple(name: "Alf")
    }

    def to_tuple(x, &bl)
      Tuple(x, &bl) # Tuple(...) -> Alf::Tuple(...) -> Support.to_tuple(...)
    end

    it 'returns a tuple already' do
      to_tuple(name: "Alf").should eq(expected)
    end

    it 'symbolizes keys' do
      to_tuple('name' => "Alf").should eq(expected)
    end

    it 'supports a block that is delegated to remap' do
      to_tuple('name' => "alf", 'version' => "foo"){|k,v|
        k.should be_a(Symbol)
        v.upcase
      }.should eq(Tuple(name: "ALF", version: "FOO"))
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
alf-core-0.15.0 spec/unit/alf-support/test_to_tuple.rb
alf-core-0.14.0 spec/unit/alf-support/test_to_tuple.rb
alf-core-0.13.1 spec/unit/alf-support/test_to_tuple.rb
alf-core-0.13.0 spec/unit/alf-support/test_to_tuple.rb