Skip to content
Browse files

all specs pass

  • Loading branch information...
1 parent c71cbfe commit 1e9419911f5d1b0342081e5d11cee7a0dcf736f5 @yyyc514 committed Jul 16, 2012
View
2 lib/sprinkle/actors/capistrano.rb
@@ -64,7 +64,7 @@ def recipes(scripts) #:nodoc:
def install(installer, roles, opts = {}) #:nodoc:
@installer = installer
- process(installer.package.name, installer.install_sequence, roles)
+ process(installer.package.name, installer.install_sequence, roles, opts)
rescue ::Capistrano::CommandError => e
raise_error(e)
ensure
View
19 spec/sprinkle/actors/capistrano_spec.rb
@@ -146,6 +146,9 @@ def create_cap(&block)
@cap = create_cap do; recipes 'deploy'; end
@cap.stub!(:run).and_return
+ @package = Package.new(@name) {}
+ @installer = Sprinkle::Installers::Transfer.new(@package, "file.txt","/tmp/file.txt")
+
@testing_errors = false
end
@@ -176,7 +179,7 @@ def create_cap(&block)
end
after do
- @cap.transfer @name, @source, @dest, @roles unless @testing_errors
+ @cap.process @package.name, @installer.install_sequence, @roles
end
end
@@ -221,6 +224,10 @@ def create_cap(&block)
@cap = create_cap do; recipes 'deploy'; end
@cap.config.stub!(:upload).and_return
+
+ @package = Package.new(@name) {}
+ @installer = Sprinkle::Installers::Transfer.new(@package, @source, @dest, :recursive => true)
+ @cap.instance_variable_set("@installer", @installer)
end
it 'should call upload with the source and destination via :scp' do
@@ -233,7 +240,8 @@ def create_cap(&block)
end
after do
- @cap.transfer @name, @source, @dest, @roles
+ @installer.instance_variable_set("@delivery", @cap)
+ @installer.process(@roles)
end
end
@@ -246,6 +254,10 @@ def create_cap(&block)
@cap = create_cap do; recipes 'deploy'; end
@cap.config.stub!(:upload).and_return
+
+ @package = Package.new(@name) {}
+ @installer = Sprinkle::Installers::Transfer.new(@package, @source,@dest, :recursive => false)
+ @cap.instance_variable_set("@installer", @installer)
end
it 'should call upload with the source and destination via :scp' do
@@ -258,7 +270,8 @@ def create_cap(&block)
end
after do
- @cap.transfer @name, @source, @dest, @roles, :recursive => false
+ @installer.instance_variable_set("@delivery", @cap)
+ @installer.process(@roles)
end
end
View
8 spec/sprinkle/actors/local_spec.rb
@@ -16,11 +16,11 @@
@roles = %w( app )
@name = 'name'
- @local.stub!(:system).and_return
+ @local.stub!(:run_command).and_return(0)
end
it 'should run the commands on the local system' do
- @local.should_receive(:system).once.and_return
+ @local.should_receive(:run_command).once.and_return(0)
@local.install @installer, @roles
end
@@ -34,11 +34,11 @@
@roles = %w( app )
@name = 'name'
- @local.stub!(:system).and_return
+ @local.stub!(:run_command).and_return(0)
end
it 'should run the commands on the local system' do
- @local.should_receive(:system).twice.and_return
+ @local.should_receive(:run_command).twice.and_return
@local.verify @verifier, @roles
end
View
8 spec/sprinkle/installers/source_spec.rb
@@ -52,22 +52,22 @@ def create_source(source, version = nil, &block)
before do
@settings = { :prefix => '/usr/local', :archives => '/usr/local/tmp', :builds => '/usr/local/stage' }
+ @settings.each { |k, v| @installer.send k, v }
end
it 'should fail if no installation area has been specified' do
- @settings.delete(:prefix)
+ @installer.options[:prefix] = nil
end
it 'should fail if no build area has been specified' do
- @settings.delete(:builds)
+ @installer.options[:builds] = nil
end
it 'should fail if no source download area has been specified' do
- @settings.delete(:archives)
+ @installer.options[:archives] = nil
end
after do
- @settings.each { |k, v| @installer.send k, v }
lambda { @installer.install_sequence }.should raise_error
end

0 comments on commit 1e94199

Please sign in to comment.
Something went wrong with that request. Please try again.