Sha256: 79cbe952efdd44b682b9fb91e3e4d0aae150a30056df250ebdf1a4d7c7f3acda

Contents?: true

Size: 1.13 KB

Versions: 1

Compression:

Stored size: 1.13 KB

Contents

require 'spec_helper'

describe Writer::SymbolMatrix do 
  describe '#initialize' do 
    it 'should set the argument as the source' do 
      source = stub 'source'
      writer = Writer::SymbolMatrix.new source
      writer.source.should == source
    end
  end

  describe '#serialization' do 
    it 'should transform the multidimentional hash into a simple dot and colons serialization' do 
      multidimentional = SymbolMatrix.new hola: {
          the: "start",
          asdfdf: 8989,
          of: {
            some: "multidimentional"
          }
        },
        stuff: "oops"
      
      writer = Writer::SymbolMatrix.new multidimentional
      writer.serialization.should == "hola.the:start hola.asdfdf:8989 hola.of.some:multidimentional stuff:oops"
    end

    context 'with argument' do 
      it 'should do the transformation appending the argument to each key-value pair' do 
        simple = SymbolMatrix.new mykey: "myvalue", otherkey: "othervalue"

        writer = Writer::SymbolMatrix.new simple
        writer.serialization("inside.").should == "inside.mykey:myvalue inside.otherkey:othervalue"
      end
    end  
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
empezar-0.2.0 spec/writer/symbolmatrix_spec.rb