Skip to content

Commit

Permalink
Fixing specs for direct-call inherited generators.
Browse files Browse the repository at this point in the history
Finally, this can work. Is it important? I don't know, but it works.
  • Loading branch information
ymendel committed Jul 28, 2009
1 parent 28da672 commit 0d4b0cc
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions spec/object_daddy_spec.rb
Expand Up @@ -538,23 +538,26 @@ def self.generator_value_method(prev)
end end


describe 'using generators called directly' do 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 it 'should use generators from the parent class' do
@class.generator_for :blah do |prev| 'blah'; end @subclass.spawn.other.should == 'bang'
@subclass.spawn.blah.should == 'blah' @subclass.spawn.blah.should == 'blah'
end end


it 'should let subclass generators override parent generators' do describe 'with subclass generators' do
pending 'figuring out what to do about this, including deciding whether or not this is even important' do before :each do
@class.generator_for :blah do |prev| 'blah'; end
# p @class
# p @subclass
# @subclass.send(:gather_exemplars)
# p @subclass.generators
@subclass.generator_for :blah do |prev| 'blip'; end @subclass.generator_for :blah do |prev| 'blip'; end
# @subclass.send(:gather_exemplars) end
# p @subclass.generators
# p @subclass.generators[:blah][:generator][:block].call it 'should still use generators from the parent class' do
# @subclass.send(:gather_exemplars) @subclass.spawn.other.should == 'bang'
end

it 'should allow overriding parent generators' do
@subclass.spawn.blah.should == 'blip' @subclass.spawn.blah.should == 'blip'
end end
end end
Expand Down

0 comments on commit 0d4b0cc

Please sign in to comment.