spec/sprinkle/package_spec.rb in sprinkle-0.2.6 vs spec/sprinkle/package_spec.rb in sprinkle-0.3.0
- old
+ new
@@ -20,11 +20,11 @@
#{installer} 'archive' do
pre :install, 'preOp'
end
end
- pre_count = pkg.installer.instance_variable_get(:@pre)[:install].length
+ pre_count = pkg.installers.first.instance_variable_get(:@pre)[:install].length
}.should change { pre_count }.by(1)
CODE
end
# More of Mitchell's meta-programming to dry up specs.
@@ -64,11 +64,11 @@
it 'should optionally accept an installer' do
pkg = package @name do
gem 'rails'
end
- pkg.installer.should_not be_nil
+ pkg.installers.should_not be_empty
end
it 'should optionally accept dependencies' do
pkg = package @name do
requires :webserver, :database
@@ -121,47 +121,57 @@
it 'should optionally accept an apt installer' do
pkg = package @name do
apt %w( deb1 deb2 )
end
pkg.should respond_to(:apt)
- pkg.installer.class.should == Sprinkle::Installers::Apt
+ pkg.installers.first.class.should == Sprinkle::Installers::Apt
end
it 'should optionally accept an rpm installer' do
pkg = package @name do
rpm %w( rpm1 rpm2 )
end
pkg.should respond_to(:rpm)
- pkg.installer.class.should == Sprinkle::Installers::Rpm
+ pkg.installers.first.class.should == Sprinkle::Installers::Rpm
end
it 'should optionally accept a gem installer' do
pkg = package @name do
gem 'gem'
end
pkg.should respond_to(:gem)
- pkg.installer.class.should == Sprinkle::Installers::Gem
+ pkg.installers.first.class.should == Sprinkle::Installers::Gem
end
it 'should optionally accept a source installer' do
pkg = package @name do
source 'archive'
end
pkg.should respond_to(:source)
- pkg.installer.class.should == Sprinkle::Installers::Source
+ pkg.installers.first.class.should == Sprinkle::Installers::Source
end
+ it 'should allow multiple installer steps to be defined and respect order' do
+ pkg = package @name do
+ source 'archive'
+ gem 'momoney'
+ end
+
+ pkg.installers.length.should == 2
+ pkg.installers[0].class.should == Sprinkle::Installers::Source
+ pkg.installers[1].class.should == Sprinkle::Installers::Gem
+ end
end
describe 'with a source installer' do
it 'should optionally accept a block containing customisations' do
pkg = package @name do
source 'archive' do; end
end
pkg.should respond_to(:source)
- pkg.installer.class.should == Sprinkle::Installers::Source
+ pkg.installers.first.class.should == Sprinkle::Installers::Source
end
it 'should forward block to installer superclass' do
check_block_forwarding_on(:source)
end
@@ -212,11 +222,11 @@
end
describe 'with an installer' do
before do
- @package.installer = @installer
+ @package.installers = [ @installer ]
end
it 'should configure itself against the deployment context' do
@installer.should_receive(:defaults).with(@deployment).and_return
end
@@ -240,11 +250,11 @@
end
describe 'with verifications' do
before do
@pkg = create_package_with_blank_verify(3)
- @pkg.installer = @installer
+ @pkg.installers = [ @installer ]
@installer.stub!(:defaults)
@installer.stub!(:process)
end
describe 'with forcing' do
@@ -301,10 +311,10 @@
before do
@deployment = mock(Sprinkle::Deployment)
@roles = [ :app, :db ]
@installer = mock(Sprinkle::Installers::Installer, :defaults => true, :process => true)
@pkg = create_package_with_blank_verify(3)
- @pkg.installer = @installer
+ @pkg.installers = [ @installer ]
@installer.stub!(:defaults)
@installer.stub!(:process)
@logger = mock(ActiveSupport::BufferedLogger, :debug => true, :debug? => true)
@logger.stub!(:info)
end