Permalink
Browse files

Fixing specs for direct-call inherited generators.

Finally, this can work. Is it important? I don't know, but it works.
  • Loading branch information...
1 parent 28da672 commit 0d4b0cc609efe3004f4934421be1c2468c5275ff @ymendel ymendel committed Jul 28, 2009
Showing with 16 additions and 13 deletions.
  1. +16 −13 spec/object_daddy_spec.rb
View
@@ -538,23 +538,26 @@ def self.generator_value_method(prev)
end
describe 'using generators called directly' do
+ before :each do
+ @class.generator_for :other do |prev| 'bang'; end
+ @class.generator_for :blah do |prev| 'blah'; end
+ end
+
it 'should use generators from the parent class' do
- @class.generator_for :blah do |prev| 'blah'; end
- @subclass.spawn.blah.should == 'blah'
+ @subclass.spawn.other.should == 'bang'
+ @subclass.spawn.blah.should == 'blah'
end
- it 'should let subclass generators override parent generators' do
- pending 'figuring out what to do about this, including deciding whether or not this is even important' do
- @class.generator_for :blah do |prev| 'blah'; end
- # p @class
- # p @subclass
- # @subclass.send(:gather_exemplars)
- # p @subclass.generators
+ describe 'with subclass generators' do
+ before :each do
@subclass.generator_for :blah do |prev| 'blip'; end
- # @subclass.send(:gather_exemplars)
- # p @subclass.generators
- # p @subclass.generators[:blah][:generator][:block].call
- # @subclass.send(:gather_exemplars)
+ end
+
+ it 'should still use generators from the parent class' do
+ @subclass.spawn.other.should == 'bang'
+ end
+
+ it 'should allow overriding parent generators' do
@subclass.spawn.blah.should == 'blip'
end
end

0 comments on commit 0d4b0cc

Please sign in to comment.