Sha256: b92e4ab68b5e287b7a7a98db9c56e51220fffc8d1eb69227e348b705f29011c8
Contents?: true
Size: 623 Bytes
Versions: 18
Compression:
Stored size: 623 Bytes
Contents
require 'spec_helper' describe 'Using Struct as an embedded value attribute' do before do module Examples Point = Struct.new(:x, :y) class Rectangle include Virtus attribute :top_left, Point attribute :bottom_right, Point end end end subject do Examples::Rectangle.new(:top_left => [ 3, 5 ], :bottom_right => [ 8, 7 ]) end specify 'initialize a struct object with correct attributes' do subject.top_left.x.should be(3) subject.top_left.y.should be(5) subject.bottom_right.x.should be(8) subject.bottom_right.y.should be(7) end end
Version data entries
18 entries across 18 versions & 2 rubygems