Sha256: 40525c183860377db3e10f7d78c5eb035f360e30132bc18bdc47845e5fdaeb35

Contents?: true

Size: 1.49 KB

Versions: 2

Compression:

Stored size: 1.49 KB

Contents

# -*- coding: utf-8 -*-
require 'spec_helper'
require '4foodiez/partner/partner_store_serializer'

describe ForFoodiez::RestPartnerStoresSerializer do

  subject { Ixtlan::Babel::Factory.new.new_serializer( stores ) }

  let( :stores ){ ForFoodiez::RestPartnerStores.new( :stores => [ store ], :offset => 10, :total_count => 123 ) }

  let( :store ){ Factory.partner_store }

  it 'should serialize' do
    expected = {
      "offset"=>10,
      "total_count"=>123,
      "stores"=>[{
                   "id"=>store.id,
                   "longitude"=>-71.18972,
                   "latitude"=>41.52639,
                   # "name"=>"mine",
                   "phone"=>"(91) 123-23",
                   "fax"=>"[0]33 123/323",
                   "url"=>"http://valentin.de",
                   "mail"=>"mail@valentin.de",
                   "address"=>"Valentin Museum, München",
                   "description"=>"schöne eis-skulptur auf suppen-teller - leider geschmolzen",
                   # "updated_at"=>"2013-02-17T14:58:41.55607318380+0530",
                   "partner_id"=> store.partner.id,
                   "modified_by"=>{
                     "id"=>1,
                     "login"=>"system",
                     "name"=>"System"
                   }
                 }]
    }
    result = subject.to_hash
    Docu.list_response( 'partner_stores', subject )
    result['stores'][0].delete("updated_at").wont_be_nil
    result['stores'][0].delete("name").wont_be_nil
    result.must_equal expected
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ixtlan-configuration-0.2.2 spec/configaration_serializer_spec.rb~
ixtlan-configuration-0.2.1 spec/configaration_serializer_spec.rb~