Skip to content

Commit

Permalink
Adding spec for yielding generated-subclass object.
Browse files Browse the repository at this point in the history
Also getting rid of paren warnings.
  • Loading branch information
ymendel committed Apr 23, 2009
1 parent 75314b4 commit e53c992
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions spec/object_daddy_spec.rb
Expand Up @@ -453,12 +453,21 @@ def self.generator_value_method(prev)

it 'should generate an instance of a specified concrete subclass (specced using a symbol)' do
Widget.generates_subclass :SubWidget
Widget.spawn.should be_instance_of SubWidget
Widget.spawn.should be_instance_of(SubWidget)
end

it 'should generate an instance of a specified concrete subclass (specced using a string)' do
Widget.generates_subclass 'SubWidget'
Widget.spawn.should be_instance_of SubWidget
Widget.spawn.should be_instance_of(SubWidget)
end

it 'should generate an instance of a specified concrete subclass and yield to a block if given' do
yielded_object = nil
Widget.generates_subclass :SubWidget
Widget.spawn do |obj|
yielded_object = obj
end
yielded_object.should be_instance_of(SubWidget)
end

describe 'using exemplar files' do
Expand Down

0 comments on commit e53c992

Please sign in to comment.