Sha256: 63b8e1e6e4bf6825b12cfbb9e990426e62811a4bf8f834a97f4b3dadb4141e48
Contents?: true
Size: 868 Bytes
Versions: 5
Compression:
Stored size: 868 Bytes
Contents
require 'spec_helper' # TODO: split this into separate files - solnic describe Virtus do let(:model) do Class.new do include Virtus attribute :name, String attribute :age, Integer attribute :email, String, :accessor => :private end end let(:object) do model.new(attributes) end let(:attributes) do { :name => 'john', :age => 28 } end describe '#attributes' do it "returns a hash of attributes" do object.attributes.should eql(attributes) end end describe '#to_hash' do it 'returns attributes' do object.to_hash.should == object.attributes end end describe "#attributes=" do before do object.attributes = attributes end it "sets attribute values for publicly accessible attributes" do object.attributes.should eql(attributes) end end end
Version data entries
5 entries across 5 versions & 1 rubygems