Sha256: 46c02d2216b202f1d15e76e95eeb2d897c400f40480faeb96e687bd5ad89cd4c
Contents?: true
Size: 1.15 KB
Versions: 6
Compression:
Stored size: 1.15 KB
Contents
require 'spec_helper' describe Anima, 'simple integration' do subject { class_under_test.new(attributes) } let(:class_under_test) do Class.new do include Anima.new(:firstname, :lastname) def self.name 'TestClass' end end end context 'when instanciated with all attributes' do let(:attributes) do { :firstname => 'Markus', :lastname => 'Schirp' } end its(:firstname) { should eql('Markus') } its(:lastname) { should eql('Schirp') } end context 'with instanciated with extra attributes' do let(:attributes) do { :firstname => 'Markus', :lastname => 'Schirp', :extra => 'Foo' } end it 'should raise error' do expect { subject }.to raise_error( Anima::Error::Unknown, 'Unknown attribute(s) [:extra] for TestClass' ) end end context 'when instanciated with missing attribute' do let(:attributes) { {} } it 'should raise error' do expect { subject }.to raise_error( Anima::Error::Missing, 'Missing attribute(s) :firstname for TestClass' ) end end end
Version data entries
6 entries across 6 versions & 1 rubygems