Sha256: c3022631a079f3b36898b6ef44946215b9d1db6e61dfd2fa2f79bb1b3f250cb6
Contents?: true
Size: 1.26 KB
Versions: 3
Compression:
Stored size: 1.26 KB
Contents
require File.dirname(__FILE__) + '/../spec_helper' describe Entity do describe "an object which is an entity" do class SomeEntity include Entity end before(:each) do @entity = SomeEntity.new(:identifier => 'e_id') end it "should allow creation with an identifier" do @entity.identifier.should == 'e_id' end it "should require an argument hash" do lambda{ SomeEntity.new(:foo) }.should raise_error(ArgumentError, /supply a hash/) end it "should require an identifier" do lambda{ p = SomeEntity.new({}) }.should raise_error(ArgumentError, /identifier/) end it "should allow testing against a given identifier" do @entity.is?('e_id').should be_true end it "should assign other argument hash entries to ivars & accessorize them" do entity = SomeEntity.new(:identifier => 'e_id', :foo => 'red', :bar => 'blue') entity.foo.should == 'red' entity.bar.should == 'blue' end it "should accessorize ad-hoc args for all instances of that class" do SomeEntity.new(:identifier => 'e_id', :foo => 'red', :bar => 'blue') entity = SomeEntity.new(:identifier => 'e_id', :foo => 'green') entity.foo.should == 'green' entity.bar.should == nil end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
jlindley-rlottery-0.1.2 | spec/rlottery/entity_spec.rb |
jlindley-rlottery-0.1.3 | spec/rlottery/entity_spec.rb |
jlindley-rlottery-0.1.4 | spec/rlottery/entity_spec.rb |