spec/sprinkle/package_spec.rb in sprinkle-0.4.2 vs spec/sprinkle/package_spec.rb in sprinkle-0.5.0.rc1

- old
+ new

@@ -149,11 +149,11 @@ end pkg.should respond_to(:noop) pkg.installers.first.class.should == Sprinkle::Installers::Runner @installer = pkg.installers.first @install_commands = @installer.send :install_commands - @install_commands.should == 'echo noop' + @install_commands.should == ['echo noop'] end it 'should optionally accept an group installer' do pkg = package @name do add_group 'bob' @@ -393,10 +393,16 @@ @d = package :d do; end @e = package :e do; optional :d; end end it 'should be able to return a dependency hierarchy tree' do + @ai, @bi, @ci, @di, @ei = @a, @b, @c, @d, @e + @b.should_receive(:instance).any_number_of_times.and_return(@bi) + @c.should_receive(:instance).any_number_of_times.and_return(@ci) + @d.should_receive(:instance).any_number_of_times.and_return(@di) + @e.should_receive(:instance).any_number_of_times.and_return(@ei) + @a.tree.flatten.should == [ @d, @c, @b, @a ] @b.tree.flatten.should == [ @d, @c, @b ] @c.tree.flatten.should == [ @d, @c ] @d.tree.flatten.should == [ @d ] @e.tree.flatten.should == [ @e, @d ] @@ -433,10 +439,12 @@ end @count.should == 3 end it 'should maintain a depth count of how deep the hierarchy is' do - @b.should_receive(:tree).with(2).and_return([@b]) + instance=mock + @b.should_receive(:instance).and_return(instance) + instance.should_receive(:tree).with(2).and_return([@b]) @a.tree do; end end end