Sha256: a952dc7da3598d34a6848f41a1f6be0c4e812a7b4b0e6c791d9c9ca2e1c21bca
Contents?: true
Size: 866 Bytes
Versions: 11
Compression:
Stored size: 866 Bytes
Contents
require 'spec_helper' describe Virtus, '#attributes' do share_examples_for 'attribute hash' do it 'includes all attributes' do subject.attributes = { :test => 'Hello World', :test_priv => 'Yo' } expect(subject.attributes).to eql(:test => 'Hello World') end end context 'with a class' do let(:model) { Class.new { include Virtus attribute :test, String attribute :test_priv, String, :reader => :private } } it_behaves_like 'attribute hash' do subject { model.new } end end context 'with an instance' do subject { model.new } let(:model) { Class.new } before do subject.extend(Virtus) subject.attribute :test, String subject.attribute :test_priv, String, :reader => :private end it_behaves_like 'attribute hash' end end
Version data entries
11 entries across 11 versions & 1 rubygems