Sha256: d7565bb95fa1f64528e7965de1f4f49ee4975c017a4e45ffa0f8849cc533a8ab
Contents?: true
Size: 1.13 KB
Versions: 14
Compression:
Stored size: 1.13 KB
Contents
require 'spec_helper' class Package include Virtus attribute :dimensions, Hash[Symbol => Float] attribute :meta_info , Hash[String => String] end describe Package do let(:instance) do described_class.new( :dimensions => { 'width' => "2.2", :height => 2, "length" => 4.5 }, :meta_info => { 'from' => :Me , :to => 'You' } ) end let(:dimensions) { instance.dimensions } let(:meta_info) { instance.meta_info } describe '#dimensions' do subject { dimensions } it { should have(3).keys } it { should have_key :width } it { should have_key :height } it { should have_key :length } it 'should be coerced to [Symbol => Float] format' do dimensions[:width].should be_eql(2.2) dimensions[:height].should be_eql(2.0) dimensions[:length].should be_eql(4.5) end end describe '#meta_info' do subject { meta_info } it { should have(2).keys } it { should have_key 'from' } it { should have_key 'to' } it 'should be coerced to [String => String] format' do meta_info['from'].should == 'Me' meta_info['to'].should == 'You' end end end
Version data entries
14 entries across 14 versions & 1 rubygems