require File.dirname(__FILE__) + '/../spec_helper' describe Sprinkle::Sequence do before do @sequence = Sprinkle::Sequence.new do section1 do 'command1' end section2 do 'command2' end end end describe 'during initialization' do it 'should yield the block, storing all section definitions provided' do @sequence.stages.size.should == 2 end end describe 'during iteration' do before do @stages = { } @sequence.each do |stage, commands| @stages[stage] = commands end end it 'should yield to a given block with the stage and commands for that stage' do @stages.size.should == 2 @stages.keys.should include(:section1) @stages[:section1].should == 'command1' @stages.keys.should include(:section2) @stages[:section2].should == 'command2' end end end