Sha256: a15aa4f8907aca34a50e01e07ab785f114a7ddc560bb8c7724cbb2dabd310f22
Contents?: true
Size: 683 Bytes
Versions: 1
Compression:
Stored size: 683 Bytes
Contents
require './spec/spec_helper' class Article include Virtus attribute :author, String def author super || '<unknown>' end def author=(name) super unless name == 'Brad' end end describe Article, 'override' do it 'Alice is an allowed author' do Article.new(:author => 'Alice').author.should == 'Alice' end it 'Brad isn not an allowed author' do Article.new(:author => 'Brad').author.should == '<unknown>' end context 'with author' do subject { Article.new(:author => 'John') } its(:author) { should == 'John' } end context 'without author' do subject { Article.new } its(:author) { should == '<unknown>' } end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
virtus-0.0.10 | examples/override_attribute_methods_spec.rb |