kumade 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2008 Joe Ferris and thoughtbot, inc.
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Kumade [![Build Status](https://secure.travis-ci.org/gabebw/kumade.png)](http://travis-ci.org/gabebw/kumade)
1
+ # Kumade [![Build Status](https://secure.travis-ci.org/thoughtbot/kumade.png)](http://travis-ci.org/gabebw/kumade)
2
2
  Kumade is a set of basic Rake tasks for deploying to Heroku. It aims to
3
3
  provide most of what you want. Unlike other Heroku deploy gems, it is
4
4
  well-tested.
@@ -38,6 +38,10 @@ The default task is to deploy to staging:
38
38
 
39
39
  $ kumade # equivalent to "kumade deploy staging"
40
40
 
41
+ ## Does it support the Cedar stack?
42
+
43
+ Yes.
44
+
41
45
  ## Sample Output
42
46
 
43
47
  ### Normal mode
@@ -119,13 +123,19 @@ The default task is to deploy to staging:
119
123
  ==> Deploying to: origin
120
124
  ==> ! Cannot deploy: "origin" remote does not point to Heroku
121
125
 
122
-
123
126
  ## Compatibility
127
+
124
128
  Tested against:
125
- * MRI 1.8.7
126
- * MRI 1.9.2
127
- * REE 1.8.7
129
+
130
+ * MRI 1.8.7
131
+ * MRI 1.9.2
132
+ * REE 1.8.7
128
133
 
129
134
  ## What's with the name?
135
+
130
136
  Kumade ([pronunciation here](http://translate.google.com/#ja|en|熊手)) means
131
137
  "bamboo rake" in Japanese.
138
+
139
+ ## License
140
+
141
+ kumade is Copyright © thoughtbot. It is free software, and may be redistributed under the terms specified in the LICENSE file.
@@ -1,4 +1,4 @@
1
- @creates-remote
1
+ @extra-timeout @creates-remote
2
2
  Feature: Kumade executable
3
3
  As a user
4
4
  I want to be able to use the kumade executable
@@ -18,9 +18,13 @@ Feature: Kumade executable
18
18
  ==> Git repo is clean
19
19
  ==> Rake passed
20
20
  ==> Packaged assets with Jammit
21
+ run git push origin master
21
22
  ==> Pushed master -> origin
23
+ run git push -f pretend-staging master
22
24
  ==> Force pushed master -> pretend-staging
25
+ run bundle exec heroku rake db:migrate --app pretend-staging-app
23
26
  ==> Migrated pretend-staging-app
27
+ run git checkout master && git branch -D deploy
24
28
  ==> Deployed to: pretend-staging
25
29
  """
26
30
  But the output should not contain "==> Packaged assets with More"
@@ -33,3 +37,7 @@ Feature: Kumade executable
33
37
  When I run `kumade deploy bamboo`
34
38
  Then the output should contain "==> Deploying to: bamboo"
35
39
  Then the output should match /Cannot deploy: /
40
+
41
+ Scenario: Deploying to a non-Heroku remote fails
42
+ When I run `kumade deploy origin`
43
+ Then the output should match /==> ! Cannot deploy: "origin" remote does not point to Heroku/
@@ -1,2 +1,6 @@
1
1
  require 'aruba/cucumber'
2
2
  require 'kumade'
3
+
4
+ Before('@extra-timeout') do
5
+ @aruba_timeout_seconds = 60
6
+ end
data/kumade.gemspec CHANGED
@@ -5,7 +5,6 @@ require "kumade/version"
5
5
  Gem::Specification.new do |s|
6
6
  s.name = "kumade"
7
7
  s.version = Kumade::VERSION
8
- s.platform = Gem::Platform::RUBY
9
8
  s.authors = ["Gabe Berke-Williams"]
10
9
  s.email = ["gabe@thoughtbot.com"]
11
10
  s.homepage = ""
data/lib/kumade.rb CHANGED
@@ -3,12 +3,11 @@ require 'kumade/thor_task'
3
3
 
4
4
  module Kumade
5
5
  def self.app_for(environment)
6
- heroku_git_url = `git remote show -n #{environment} | grep 'Push URL' | cut -d' ' -f6`.strip
7
- match = heroku_git_url.match(/^git@heroku\.com:(.+)\.git$/)
8
- if match
9
- match[1]
6
+ heroku_git_url = `git config --get remote.#{environment}.url`.strip
7
+ if heroku_git_url =~ /^git@heroku\.com:(.+)\.git$/
8
+ $1
10
9
  else
11
- ""
10
+ nil
12
11
  end
13
12
  end
14
13
  end
@@ -3,18 +3,12 @@ require 'rake'
3
3
 
4
4
  module Kumade
5
5
  class Deployer < Thor::Shell::Color
6
+ DEPLOY_BRANCH = "deploy"
6
7
  attr_reader :pretending
7
8
 
8
9
  def initialize(pretending = false)
9
10
  super()
10
- @pretending = !!pretending
11
- end
12
-
13
- def pre_deploy
14
- ensure_clean_git
15
- ensure_rake_passes
16
- package_assets
17
- git_push('origin')
11
+ @pretending = pretending
18
12
  end
19
13
 
20
14
  def deploy_to(environment)
@@ -23,35 +17,57 @@ module Kumade
23
17
  pre_deploy
24
18
  git_force_push(string_environment)
25
19
  heroku_migrate(string_environment)
20
+ post_deploy
21
+ end
22
+
23
+ def pre_deploy
24
+ ensure_clean_git
25
+ ensure_rake_passes
26
+ package_assets
27
+ git_push('origin')
26
28
  end
27
29
 
28
30
  def git_push(remote)
29
- unless pretending
30
- run_or_error("git push #{remote} master",
31
- "Failed to push master -> #{remote}")
32
- end
31
+ run_or_error("git push #{remote} master",
32
+ "Failed to push master -> #{remote}")
33
33
  success("Pushed master -> #{remote}")
34
34
  end
35
35
 
36
36
  def git_force_push(remote)
37
- unless pretending
38
- run_or_error("git push -f #{remote} master",
39
- "Failed to force push master -> #{remote}")
40
- end
37
+ run_or_error("git push -f #{remote} master",
38
+ "Failed to force push master -> #{remote}")
41
39
  success("Force pushed master -> #{remote}")
42
40
  end
43
41
 
44
42
  def heroku_migrate(environment)
45
43
  app = Kumade.app_for(environment)
46
44
 
47
- unless pretending
48
- run("bundle exec heroku rake db:migrate --app #{app}")
49
- end
45
+ heroku("rake db:migrate", app)
50
46
  success("Migrated #{app}")
51
47
  end
52
48
 
49
+ def post_deploy
50
+ run_or_error("git checkout master", "git branch -D #{DEPLOY_BRANCH}",
51
+ "Failed to clean up #{DEPLOY_BRANCH} branch")
52
+ end
53
+
54
+ def heroku(command, app)
55
+ heroku_command = if on_cedar?(app)
56
+ "bundle exec heroku run"
57
+ else
58
+ "bundle exec heroku"
59
+ end
60
+ run_or_error("#{heroku_command} #{command} --app #{app}",
61
+ "Failed to run #{command} on Heroku")
62
+ end
63
+
64
+ def on_cedar?(app)
65
+ selected_stack = `heroku stack --app '#{app}'`.split("\n").grep(/^\*/).first
66
+ selected_stack && selected_stack.include?('cedar')
67
+ end
68
+
53
69
  def ensure_clean_git
54
- if git_dirty? && ! pretending
70
+ if ! pretending && git_dirty?
55
71
  error("Cannot deploy: repo is not clean.")
56
72
  else
57
73
  success("Git repo is clean")
@@ -60,7 +76,7 @@ module Kumade
60
76
 
61
77
  def ensure_rake_passes
62
78
  if default_task_exists?
63
- if pretending || rake_succeeded?
79
+ if rake_succeeded?
64
80
  success("Rake passed")
65
81
  else
66
82
  error("Cannot deploy: tests did not pass")
@@ -93,23 +109,27 @@ module Kumade
93
109
  end
94
110
 
95
111
  def package_with_more
96
- begin
97
- system "bundle exec rake more:generate"
98
- if git_dirty?
99
- success("Packaged assets with More")
100
-
101
- git_add_and_commit_all_assets_in(more_assets_path)
112
+ success_message = "Packaged assets with More"
113
+ if pretending
114
+ success(success_message)
115
+ else
116
+ begin
117
+ run "bundle exec rake more:generate"
118
+ if git_dirty?
119
+ success(success_message)
120
+ git_add_and_commit_all_assets_in(more_assets_path)
121
+ end
122
+ rescue => more_error
123
+ error("Error: #{more_error.class}: #{more_error.message}")
102
124
  end
103
- rescue => more_error
104
- error("Error: #{more_error.class}: #{more_error.message}")
105
125
  end
106
126
  end
107
127
 
108
128
  def git_add_and_commit_all_assets_in(dir)
109
- run_or_error("git add #{dir} && git commit -m 'Assets'",
110
- "Cannot deploy: couldn't commit assets")
129
+ run_or_error "git checkout -b #{DEPLOY_BRANCH}", "git add -f #{dir}", "git commit -m 'Compiled assets'",
130
+ "Cannot deploy: couldn't commit assets"
111
131
 
112
- success("Added and committed all assets")
132
+ success "Added and committed all assets"
113
133
  end
114
134
 
115
135
  def jammit_assets_path
@@ -125,6 +145,7 @@ module Kumade
125
145
  (defined?(Jammit) ||
126
146
  begin
127
147
  require 'jammit'
148
+ true
128
149
  rescue LoadError
129
150
  false
130
151
  end)
@@ -135,6 +156,7 @@ module Kumade
135
156
  (defined?(Less::More) ||
136
157
  begin
137
158
  require 'less/more'
159
+ true
138
160
  rescue LoadError
139
161
  false
140
162
  end)
@@ -145,29 +167,26 @@ module Kumade
145
167
  end
146
168
 
147
169
  def rake_succeeded?
170
+ return true if pretending
171
+
148
172
  begin
149
- system "bundle exec rake"
173
+ run "bundle exec rake"
150
174
  rescue
151
175
  false
152
176
  end
153
177
  end
154
178
 
155
179
  def git_dirty?
156
- git_changed = `git status --short 2> /dev/null | tail -n1`
157
- dirty = git_changed.size > 0
158
- end
159
-
160
- def run(command)
161
- announce "+ #{command}"
162
- announce "- #{system command}"
163
- $?.success?
180
+ `git diff --exit-code`
181
+ !$?.success?
164
182
  end
165
183
 
166
- def run_or_error(command, error_message)
167
- if ! pretending
168
- unless run(command)
169
- error(error_message)
170
- end
184
+ def run_or_error(*commands, error_message)
185
+ all_commands = commands.join(' && ')
186
+ if pretending
187
+ say_status(:run, all_commands)
188
+ else
189
+ error(error_message) unless run(all_commands)
171
190
  end
172
191
  end
173
192
 
@@ -184,19 +203,12 @@ module Kumade
184
203
  say("==> #{message}", :green)
185
204
  end
186
205
 
187
- def string_present?(maybe_string)
188
- maybe_string.is_a?(String) && maybe_string.size > 0
189
- end
190
-
191
206
  def ensure_heroku_remote_exists_for(environment)
192
207
  if remote_exists?(environment)
193
- if Kumade.app_for(environment)
194
- app_name = Kumade.app_for(environment)
195
- if string_present?(app_name)
196
- success("#{environment} is a Heroku remote")
197
- else
198
- error(%{Cannot deploy: "#{environment}" remote does not point to Heroku})
199
- end
208
+ if app_name = Kumade.app_for(environment)
209
+ success("#{environment} is a Heroku remote")
210
+ else
211
+ error(%{Cannot deploy: "#{environment}" remote does not point to Heroku})
200
212
  end
201
213
  else
202
214
  error(%{Cannot deploy: "#{environment}" remote does not exist})
@@ -207,14 +219,7 @@ module Kumade
207
219
  if pretending
208
220
  true
209
221
  else
210
- `git remote`.split("\n").include?(remote_name)
211
- end
212
- end
213
-
214
- def initialize_rake
215
- if Rake.application.tasks.empty?
216
- Rake.application.options.rakelib = ['rakelib']
217
- Rake.application.load_rakefile
222
+ `git remote` =~ /^#{remote_name}$/
218
223
  end
219
224
  end
220
225
  end
@@ -5,7 +5,7 @@ module Kumade
5
5
  default_task :deploy
6
6
 
7
7
  desc "deploy [ENV]", "Deploy to ENV (default: staging)"
8
- method_option :pretend, :aliases => "-p", :desc => "Pretend Mode - print out what kumade would do"
8
+ method_option :pretend, :aliases => "-p", :desc => "Pretend Mode - print out what kumade would do", :default => false
9
9
  def deploy(environment = 'staging')
10
10
  say("==> In Pretend Mode", :red) if options[:pretend]
11
11
  say "==> Deploying to: #{environment}"
@@ -1,3 +1,3 @@
1
1
  module Kumade
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -1,586 +1,598 @@
1
1
  require 'spec_helper'
2
- require 'jammit'
3
-
4
- module Kumade
5
- describe Deployer, "#pre_deploy" do
6
- before { subject.stub(:say) }
7
-
8
- it "calls the correct methods in order" do
9
- %w(
10
- ensure_clean_git
11
- ensure_rake_passes
12
- package_assets
13
- git_push
14
- ).each do |task|
15
- subject.should_receive(task).ordered.and_return(true)
16
- end
17
2
 
18
- subject.pre_deploy
19
- end
3
+ describe Kumade::Deployer, "#pre_deploy" do
4
+ before { subject.stub(:say) }
20
5
 
21
- it "pushes to origin" do
22
- %w(
23
- ensure_clean_git
24
- ensure_rake_passes
25
- package_assets
6
+ it "calls the correct methods in order" do
7
+ %w(
8
+ ensure_clean_git
9
+ ensure_rake_passes
10
+ package_assets
11
+ git_push
26
12
  ).each do |task|
27
- subject.stub(task)
28
- end
13
+ subject.should_receive(task).ordered.and_return(true)
14
+ end
29
15
 
30
- subject.should_receive(:git_push).with('origin')
31
- subject.pre_deploy
16
+ subject.pre_deploy
17
+ end
18
+
19
+ it "pushes to origin" do
20
+ %w(
21
+ ensure_clean_git
22
+ ensure_rake_passes
23
+ package_assets
24
+ ).each do |task|
25
+ subject.stub(task)
32
26
  end
27
+
28
+ subject.should_receive(:git_push).with('origin')
29
+ subject.pre_deploy
33
30
  end
31
+ end
34
32
 
35
- describe Deployer, "#deploy_to" do
36
- let(:remote_name){ 'staging' }
37
- let(:app_name){ 'kumade-staging' }
33
+ describe Kumade::Deployer, "#deploy_to" do
34
+ let(:remote_name){ 'staging' }
35
+ let(:app_name){ 'kumade-staging' }
38
36
 
39
- before do
40
- subject.stub(:say)
41
- force_add_heroku_remote(remote_name, app_name)
42
- end
37
+ before do
38
+ subject.stub(:say)
39
+ force_add_heroku_remote(remote_name, app_name)
40
+ end
43
41
 
44
- after { remove_remote(remote_name) }
42
+ after { remove_remote(remote_name) }
45
43
 
46
- it "calls the correct methods in order" do
47
- subject.stub(:run => true)
44
+ it "calls the correct methods in order" do
45
+ subject.stub(:run => true)
48
46
 
49
- subject.should_receive(:ensure_heroku_remote_exists_for).
50
- ordered.
51
- with(remote_name)
47
+ subject.should_receive(:ensure_heroku_remote_exists_for).
48
+ ordered.
49
+ with(remote_name)
52
50
 
53
- subject.should_receive(:pre_deploy).
54
- ordered.
55
- and_return(true)
51
+ subject.should_receive(:pre_deploy).
52
+ ordered.
53
+ and_return(true)
56
54
 
57
- subject.should_receive(:git_force_push).
58
- ordered.
59
- and_return(true)
55
+ subject.should_receive(:git_force_push).
56
+ ordered.
57
+ and_return(true)
60
58
 
61
- subject.should_receive(:heroku_migrate).
62
- ordered.
63
- with(remote_name)
59
+ subject.should_receive(:heroku_migrate).
60
+ ordered.
61
+ with(remote_name)
64
62
 
65
- subject.deploy_to(remote_name)
66
- end
63
+ subject.should_receive(:post_deploy)
67
64
 
68
- it "deploys to the correct remote" do
69
- subject.stub(:ensure_heroku_remote_exists_for => true,
70
- :pre_deploy => true,
71
- :run => true)
65
+ subject.deploy_to(remote_name)
66
+ end
72
67
 
73
- subject.should_receive(:git_force_push).with(remote_name)
68
+ it "deploys to the correct remote" do
69
+ subject.stub(:ensure_heroku_remote_exists_for => true,
70
+ :pre_deploy => true,
71
+ :on_cedar? => false,
72
+ :run => true)
74
73
 
75
- subject.deploy_to(remote_name)
76
- end
74
+ subject.should_receive(:git_force_push).with(remote_name)
75
+
76
+ subject.deploy_to(remote_name)
77
77
  end
78
+ end
78
79
 
79
- describe Deployer, "#git_push" do
80
- let(:remote){ 'origin' }
80
+ describe Kumade::Deployer, "#git_push" do
81
+ let(:remote){ 'origin' }
81
82
 
82
- before { subject.stub(:say) }
83
+ before { subject.stub(:say) }
83
84
 
84
- it "calls `git push`" do
85
- subject.should_receive(:run).
86
- with("git push #{remote} master").
87
- and_return(true)
88
- subject.git_push(remote)
89
- end
85
+ it "calls `git push`" do
86
+ subject.should_receive(:run).
87
+ with("git push #{remote} master").
88
+ and_return(true)
89
+ subject.git_push(remote)
90
+ end
90
91
 
91
- context "when `git push` fails" do
92
- before { subject.stub(:run => false) }
92
+ context "when `git push` fails" do
93
+ before { subject.stub(:run => false) }
93
94
 
94
- it "prints an error message" do
95
- subject.should_receive(:error).with("Failed to push master -> #{remote}")
95
+ it "prints an error message" do
96
+ subject.should_receive(:error).with("Failed to push master -> #{remote}")
96
97
 
97
- subject.git_push(remote)
98
- end
98
+ subject.git_push(remote)
99
99
  end
100
+ end
100
101
 
101
- context "when `git push` succeeds" do
102
- before { subject.stub(:run => true) }
102
+ context "when `git push` succeeds" do
103
+ before { subject.stub(:run => true) }
103
104
 
104
- it "does not raise an error" do
105
- subject.should_not_receive(:error)
106
- subject.git_push(remote)
107
- end
105
+ it "does not raise an error" do
106
+ subject.should_not_receive(:error)
107
+ subject.git_push(remote)
108
+ end
108
109
 
109
- it "prints a success message" do
110
- subject.should_receive(:success).with("Pushed master -> #{remote}")
110
+ it "prints a success message" do
111
+ subject.should_receive(:success).with("Pushed master -> #{remote}")
111
112
 
112
- subject.git_push(remote)
113
- end
113
+ subject.git_push(remote)
114
114
  end
115
115
  end
116
+ end
116
117
 
117
- describe Deployer, "#git_force_push" do
118
- let(:remote){ 'origin' }
119
- before { subject.stub(:say) }
118
+ describe Kumade::Deployer, "#git_force_push" do
119
+ let(:remote){ 'origin' }
120
+ before { subject.stub(:say) }
120
121
 
121
- it "calls `git push -f`" do
122
- subject.should_receive(:run).
123
- with("git push -f #{remote} master").
124
- and_return(true)
125
- subject.git_force_push(remote)
126
- end
122
+ it "calls `git push -f`" do
123
+ subject.should_receive(:run).
124
+ with("git push -f #{remote} master").
125
+ and_return(true)
126
+ subject.git_force_push(remote)
127
+ end
127
128
 
128
- context "when `git push -f` fails" do
129
- before do
130
- subject.stub(:run => false)
131
- end
129
+ context "when `git push -f` fails" do
130
+ before do
131
+ subject.stub(:run => false)
132
+ end
132
133
 
133
- it "prints an error" do
134
- subject.should_receive(:error).with("Failed to force push master -> #{remote}")
135
- subject.git_force_push(remote)
136
- end
134
+ it "prints an error" do
135
+ subject.should_receive(:error).with("Failed to force push master -> #{remote}")
136
+ subject.git_force_push(remote)
137
137
  end
138
+ end
138
139
 
139
- context "when `git push -f` succeeds" do
140
- before do
141
- subject.stub(:run => true)
142
- subject.stub(:say)
143
- end
140
+ context "when `git push -f` succeeds" do
141
+ before do
142
+ subject.stub(:run => true)
143
+ subject.stub(:say)
144
+ end
144
145
 
145
- it "does not raise an error" do
146
- subject.should_not_receive(:error)
147
- subject.git_force_push(remote)
148
- end
146
+ it "does not raise an error" do
147
+ subject.should_not_receive(:error)
148
+ subject.git_force_push(remote)
149
+ end
149
150
 
150
- it "prints a success message" do
151
- subject.should_receive(:success).
152
- with("Force pushed master -> #{remote}")
151
+ it "prints a success message" do
152
+ subject.should_receive(:success).
153
+ with("Force pushed master -> #{remote}")
153
154
 
154
- subject.git_force_push(remote)
155
- end
155
+ subject.git_force_push(remote)
156
156
  end
157
157
  end
158
+ end
158
159
 
159
- describe Deployer, "#ensure_clean_git" do
160
- before { subject.stub(:say) }
160
+ describe Kumade::Deployer, "#ensure_clean_git" do
161
+ before { subject.stub(:say) }
161
162
 
162
- context "when git is dirty" do
163
- before { subject.stub(:git_dirty? => true) }
163
+ context "when git is dirty" do
164
+ before { subject.stub(:git_dirty? => true) }
164
165
 
165
- it "prints an error" do
166
- subject.should_receive(:error).with("Cannot deploy: repo is not clean.")
167
- subject.ensure_clean_git
168
- end
166
+ it "prints an error" do
167
+ subject.should_receive(:error).with("Cannot deploy: repo is not clean.")
168
+ subject.ensure_clean_git
169
169
  end
170
+ end
170
171
 
171
- context "when git is clean" do
172
- before { subject.stub(:git_dirty? => false) }
172
+ context "when git is clean" do
173
+ before { subject.stub(:git_dirty? => false) }
173
174
 
174
- it "prints a success message" do
175
- subject.should_not_receive(:error)
176
- subject.should_receive(:success).with("Git repo is clean")
175
+ it "prints a success message" do
176
+ subject.should_not_receive(:error)
177
+ subject.should_receive(:success).with("Git repo is clean")
177
178
 
178
- subject.ensure_clean_git
179
- end
179
+ subject.ensure_clean_git
180
180
  end
181
181
  end
182
+ end
182
183
 
183
- describe Deployer, "#ensure_rake_passes" do
184
- context "with a default task" do
185
- before do
186
- subject.stub(:default_task_exists? => true)
187
- end
184
+ describe Kumade::Deployer, "#ensure_rake_passes" do
185
+ context "with a default task" do
186
+ before do
187
+ subject.stub(:default_task_exists? => true)
188
+ end
188
189
 
189
- it "prints a success message if the default task succeeds" do
190
- subject.stub(:rake_succeeded? => true)
191
- subject.should_not_receive(:error)
192
- subject.should_receive(:success).with("Rake passed")
190
+ it "prints a success message if the default task succeeds" do
191
+ subject.stub(:rake_succeeded? => true)
192
+ subject.should_not_receive(:error)
193
+ subject.should_receive(:success).with("Rake passed")
193
194
 
194
- subject.ensure_rake_passes
195
- end
195
+ subject.ensure_rake_passes
196
+ end
196
197
 
197
- it "prints an error if the default task failse" do
198
- subject.stub(:rake_succeeded? => false)
199
- subject.should_receive(:error).with("Cannot deploy: tests did not pass")
198
+ it "prints an error if the default task failse" do
199
+ subject.stub(:rake_succeeded? => false)
200
+ subject.should_receive(:error).with("Cannot deploy: tests did not pass")
200
201
 
201
- subject.ensure_rake_passes
202
- end
202
+ subject.ensure_rake_passes
203
203
  end
204
204
  end
205
+ end
205
206
 
206
- describe Deployer, "#default_task_exists?" do
207
- it "returns true because a default task does exist" do
208
- subject.default_task_exists?.should be_true
209
- end
207
+ describe Kumade::Deployer, "#default_task_exists?" do
208
+ it "returns true because a default task does exist" do
209
+ subject.default_task_exists?.should be_true
210
210
  end
211
+ end
211
212
 
212
- describe Deployer, "#rake_succeeded?" do
213
- it "returns true if the default task passed" do
214
- subject.should_receive(:system).with("bundle exec rake").and_return(true)
213
+ describe Kumade::Deployer, "#rake_succeeded?" do
214
+ it "returns true if the default task passed" do
215
+ subject.should_receive(:run).with("bundle exec rake").and_return(true)
215
216
 
216
- subject.rake_succeeded?.should be_true
217
- end
217
+ subject.rake_succeeded?.should be_true
218
+ end
218
219
 
219
- it "returns false if the default task failed" do
220
- subject.should_receive(:system).with("bundle exec rake").and_raise("blerg")
221
- subject.rake_succeeded?.should be_false
222
- end
220
+ it "returns false if the default task failed" do
221
+ subject.should_receive(:run).with("bundle exec rake").and_raise("blerg")
222
+ subject.rake_succeeded?.should be_false
223
223
  end
224
+ end
224
225
 
225
- describe Deployer, "#package_assets" do
226
- context "with Jammit installed" do
227
- it "calls package_with_jammit" do
228
- subject.should_receive(:package_with_jammit)
229
- subject.package_assets
230
- end
226
+ describe Kumade::Deployer, "#package_assets" do
227
+ context "with Jammit installed" do
228
+ it "calls package_with_jammit" do
229
+ subject.should_receive(:package_with_jammit)
230
+ subject.package_assets
231
231
  end
232
+ end
232
233
 
233
- context "with Jammit not installed" do
234
- before { subject.stub(:jammit_installed? => false) }
235
- it "does not call package_with_jammit" do
236
- subject.should_not_receive(:package_with_jammit)
237
- subject.package_assets
238
- end
234
+ context "with Jammit not installed" do
235
+ before { subject.stub(:jammit_installed? => false) }
236
+ it "does not call package_with_jammit" do
237
+ subject.should_not_receive(:package_with_jammit)
238
+ subject.package_assets
239
239
  end
240
+ end
240
241
 
241
- context "with More installed" do
242
- before do
243
- subject.stub(:jammit_installed? => false)
244
- subject.stub(:more_installed? => true)
245
- end
246
-
247
- it "calls package_with_more" do
248
- subject.should_receive(:package_with_more)
249
- subject.package_assets
250
- end
242
+ context "with More installed" do
243
+ before do
244
+ subject.stub(:jammit_installed? => false)
245
+ subject.stub(:more_installed? => true)
251
246
  end
252
247
 
253
- context "with More not installed" do
254
- before do
255
- subject.stub(:jammit_installed? => false)
256
- subject.stub(:more_installed? => false)
257
- end
258
-
259
- it "does not call package_with_more" do
260
- subject.should_not_receive(:package_with_more)
261
- subject.package_assets
262
- end
248
+ it "calls package_with_more" do
249
+ subject.should_receive(:package_with_more)
250
+ subject.package_assets
263
251
  end
264
252
  end
265
253
 
266
- describe Deployer, "#package_with_jammit" do
254
+ context "with More not installed" do
267
255
  before do
268
- subject.stub(:git_add_and_commit_all_assets_in)
269
- subject.stub(:say)
270
- Jammit.stub(:package!)
256
+ subject.stub(:jammit_installed? => false)
257
+ subject.stub(:more_installed? => false)
271
258
  end
272
259
 
273
- it "calls Jammit.package!" do
274
- Jammit.should_receive(:package!).once
275
- subject.package_with_jammit
260
+ it "does not call package_with_more" do
261
+ subject.should_not_receive(:package_with_more)
262
+ subject.package_assets
276
263
  end
264
+ end
265
+ end
277
266
 
278
- context "with updated assets" do
279
- before { subject.stub(:git_dirty? => true) }
267
+ describe Kumade::Deployer, "#package_with_jammit" do
268
+ before do
269
+ subject.stub(:git_add_and_commit_all_assets_in)
270
+ subject.stub(:say)
271
+ Jammit.stub(:package!)
272
+ end
280
273
 
281
- it "prints the correct message" do
282
- subject.should_receive(:success).with("Packaged assets with Jammit")
274
+ it "calls Jammit.package!" do
275
+ Jammit.should_receive(:package!).once
276
+ subject.package_with_jammit
277
+ end
283
278
 
284
- subject.package_with_jammit
285
- end
279
+ context "with updated assets" do
280
+ before { subject.stub(:git_dirty? => true) }
286
281
 
287
- it "calls git_add_and_commit_all_assets_in" do
288
- subject.stub(:jammit_assets_path => 'jammit-assets')
289
- subject.should_receive(:git_add_and_commit_all_assets_in).
290
- with('jammit-assets').
291
- and_return(true)
282
+ it "prints the correct message" do
283
+ subject.should_receive(:success).with("Packaged assets with Jammit")
292
284
 
293
- subject.package_with_jammit
294
- end
285
+ subject.package_with_jammit
295
286
  end
296
287
 
297
- it "prints an error if packaging failed" do
298
- Jammit.stub(:package!) do
299
- raise Jammit::MissingConfiguration.new("random Jammit error")
300
- end
301
- subject.should_receive(:error).with("Error: Jammit::MissingConfiguration: random Jammit error")
288
+ it "calls git_add_and_commit_all_assets_in" do
289
+ subject.stub(:jammit_assets_path => 'jammit-assets')
290
+ subject.should_receive(:git_add_and_commit_all_assets_in).
291
+ with('jammit-assets').
292
+ and_return(true)
302
293
 
303
294
  subject.package_with_jammit
304
295
  end
296
+ end
305
297
 
306
- context "no assets were added" do
307
- before { subject.stub(:git_dirty? => false) }
298
+ it "prints an error if packaging failed" do
299
+ Jammit.stub(:package!) do
300
+ raise Jammit::MissingConfiguration.new("random Jammit error")
301
+ end
302
+ subject.should_receive(:error).with("Error: Jammit::MissingConfiguration: random Jammit error")
308
303
 
309
- it "does not call git_add_and_commit_all_jammit_assets" do
310
- subject.should_not_receive(:git_add_and_commit_all_assets_in)
304
+ subject.package_with_jammit
305
+ end
311
306
 
312
- subject.package_with_jammit
313
- end
307
+ context "no assets were added" do
308
+ before { subject.stub(:git_dirty? => false) }
314
309
 
315
- it "does not print a success message" do
316
- subject.should_not_receive(:success)
317
- subject.package_with_jammit
318
- end
319
- end
320
- end
310
+ it "does not call git_add_and_commit_all_jammit_assets" do
311
+ subject.should_not_receive(:git_add_and_commit_all_assets_in)
321
312
 
322
- describe Deployer, "#package_with_more" do
323
- before do
324
- subject.stub(:git_add_and_commit_all_assets_in => true,
325
- :more_assets_path => 'assets')
326
- subject.stub(:say)
313
+ subject.package_with_jammit
327
314
  end
328
315
 
329
- it "calls the more:generate task" do
330
- subject.should_receive(:system).with("bundle exec rake more:generate")
331
- subject.package_with_more
316
+ it "does not print a success message" do
317
+ subject.should_not_receive(:success)
318
+ subject.package_with_jammit
332
319
  end
320
+ end
321
+ end
333
322
 
334
- context "with changed assets" do
335
- it "prints a success message" do
336
- subject.stub(:system).with("bundle exec rake more:generate")
337
- subject.stub(:git_dirty? => true)
338
- subject.should_receive(:success).with("Packaged assets with More")
323
+ describe Kumade::Deployer, "#package_with_more" do
324
+ before do
325
+ subject.stub(:git_add_and_commit_all_assets_in => true,
326
+ :more_assets_path => 'assets')
327
+ subject.stub(:say)
328
+ end
339
329
 
340
- subject.package_with_more
341
- end
330
+ it "calls the more:generate task" do
331
+ subject.should_receive(:run).with("bundle exec rake more:generate")
332
+ subject.package_with_more
333
+ end
342
334
 
343
- it "calls git_add_and_commit_all_assets_in if assets were added" do
344
- subject.stub(:git_dirty? => true,
345
- :more_assets_path => 'blerg')
346
- subject.stub(:system).with("bundle exec rake more:generate")
347
- subject.should_receive(:git_add_and_commit_all_assets_in).
348
- with('blerg').
349
- and_return(true)
335
+ context "with changed assets" do
336
+ it "prints a success message" do
337
+ subject.stub(:run).with("bundle exec rake more:generate")
338
+ subject.stub(:git_dirty? => true)
339
+ subject.should_receive(:success).with("Packaged assets with More")
350
340
 
351
- subject.package_with_more
352
- end
341
+ subject.package_with_more
353
342
  end
354
343
 
355
- context "with no changed assets" do
356
- it "prints no message" do
357
- subject.stub(:system).with("bundle exec rake more:generate")
358
- subject.stub(:git_dirty? => false)
359
- subject.should_not_receive(:say)
344
+ it "calls git_add_and_commit_all_assets_in if assets were added" do
345
+ subject.stub(:git_dirty? => true,
346
+ :more_assets_path => 'blerg')
347
+ subject.stub(:run).with("bundle exec rake more:generate")
348
+ subject.should_receive(:git_add_and_commit_all_assets_in).
349
+ with('blerg').
350
+ and_return(true)
360
351
 
361
- subject.package_with_more
362
- end
352
+ subject.package_with_more
353
+ end
354
+ end
363
355
 
364
- it "does not call git_add_and_commit_all_more_assets" do
365
- subject.stub(:system).with("bundle exec rake more:generate")
366
- subject.stub(:git_dirty? => false)
367
- subject.should_not_receive(:git_add_and_commit_all_assets_in)
356
+ context "with no changed assets" do
357
+ it "prints no message" do
358
+ subject.stub(:run).with("bundle exec rake more:generate")
359
+ subject.stub(:git_dirty? => false)
360
+ subject.should_not_receive(:say)
368
361
 
369
- subject.package_with_more
370
- end
362
+ subject.package_with_more
371
363
  end
372
364
 
373
- it "prints an error if packaging failed" do
374
- subject.stub(:system) do |arg|
375
- if arg == "bundle exec rake more:generate"
376
- raise "blerg"
377
- end
378
- end
379
-
380
- subject.should_receive(:error).with("Error: RuntimeError: blerg")
365
+ it "does not call git_add_and_commit_all_more_assets" do
366
+ subject.stub(:run).with("bundle exec rake more:generate")
367
+ subject.stub(:git_dirty? => false)
368
+ subject.should_not_receive(:git_add_and_commit_all_assets_in)
381
369
 
382
370
  subject.package_with_more
383
371
  end
384
372
  end
385
373
 
386
- describe Deployer, "#git_add_and_commit_all_assets_in" do
387
- before do
388
- subject.stub(:run => true)
389
- subject.stub(:say)
374
+ it "prints an error if packaging failed" do
375
+ subject.stub(:run) do |arg|
376
+ if arg == "bundle exec rake more:generate"
377
+ raise "blerg"
378
+ end
390
379
  end
391
380
 
392
- it "prints a success message" do
393
- subject.should_receive(:success).with("Added and committed all assets")
381
+ subject.should_receive(:error).with("Error: RuntimeError: blerg")
394
382
 
395
- subject.git_add_and_commit_all_assets_in('blerg')
396
- end
383
+ subject.package_with_more
384
+ end
385
+ end
397
386
 
398
- it "runs the correct commands" do
399
- subject.should_receive(:run).
400
- with("git add blerg && git commit -m 'Assets'")
387
+ describe Kumade::Deployer, "#git_add_and_commit_all_assets_in" do
388
+ before do
389
+ subject.stub(:run => true)
390
+ subject.stub(:say)
391
+ end
401
392
 
402
- subject.git_add_and_commit_all_assets_in('blerg')
403
- end
393
+ it "prints a success message" do
394
+ subject.should_receive(:success).with("Added and committed all assets")
404
395
 
405
- it "prints an error if it could not add and commit assets" do
406
- subject.stub(:run => false)
407
- subject.should_receive(:error).with("Cannot deploy: couldn't commit assets")
396
+ subject.git_add_and_commit_all_assets_in('blerg')
397
+ end
408
398
 
409
- subject.git_add_and_commit_all_assets_in('blerg')
410
- end
399
+ it "runs the correct commands" do
400
+ subject.should_receive(:run).
401
+ with("git checkout -b deploy && git add -f blerg && git commit -m 'Compiled assets'")
402
+
403
+ subject.git_add_and_commit_all_assets_in('blerg')
411
404
  end
412
405
 
413
- describe Deployer, "#jammit_assets_path" do
414
- it "returns the correct asset path" do
415
- Jammit.stub(:package_path => 'blerg')
416
- current_dir = File.expand_path(Dir.pwd)
417
- subject.jammit_assets_path.should == File.join(current_dir, 'public', 'blerg')
418
- end
406
+ it "prints an error if it could not add and commit assets" do
407
+ subject.stub(:run => false)
408
+ subject.should_receive(:error).with("Cannot deploy: couldn't commit assets")
409
+
410
+ subject.git_add_and_commit_all_assets_in('blerg')
411
+ end
412
+ end
413
+
414
+ describe Kumade::Deployer, "#jammit_assets_path" do
415
+ it "returns the correct asset path" do
416
+ Jammit.stub(:package_path => 'blerg')
417
+ current_dir = File.expand_path(Dir.pwd)
418
+ subject.jammit_assets_path.should == File.join(current_dir, 'public', 'blerg')
419
419
  end
420
+ end
420
421
 
421
- describe Deployer, "#more_assets_path" do
422
- it "returns the correct asset path" do
423
- module ::Less
424
- class More
425
- def self.destination_path
426
- 'blerg'
427
- end
422
+ describe Kumade::Deployer, "#more_assets_path" do
423
+ it "returns the correct asset path" do
424
+ module ::Less
425
+ class More
426
+ def self.destination_path
427
+ 'blerg'
428
428
  end
429
429
  end
430
- subject.more_assets_path.should == 'public/blerg'
431
430
  end
431
+ subject.more_assets_path.should == 'public/blerg'
432
432
  end
433
+ end
433
434
 
434
- describe Deployer, "#jammit_installed?" do
435
- it "returns true because it's loaded by the Gemfile" do
436
- subject.jammit_installed?.should be_true
437
- end
435
+ describe Kumade::Deployer, "#jammit_installed?" do
436
+ it "returns true because it's loaded by the Gemfile" do
437
+ Kumade::Deployer.new.jammit_installed?.should be_true
438
438
  end
439
439
 
440
- describe Deployer, "#more_installed?" do
441
- before do
442
- if defined?(Less)
443
- Object.send(:remove_const, :Less)
444
- end
445
- end
446
-
447
- it "returns false if it does not find Less::More" do
448
- subject.more_installed?.should be_false
449
- end
440
+ it "returns false if jammit is not installed" do
441
+ Kumade::Deployer.new.jammit_installed?.should be_true
442
+ end
443
+ end
450
444
 
451
- it "returns true if it finds Less::More" do
452
- module Less
453
- class More
454
- end
455
- end
456
- subject.more_installed?.should be_true
445
+ describe Kumade::Deployer, "#more_installed?" do
446
+ before do
447
+ if defined?(Less)
448
+ Object.send(:remove_const, :Less)
457
449
  end
458
450
  end
459
451
 
460
- describe Deployer, "#heroku_migrate" do
461
- let(:environment){ 'staging' }
462
- let(:app_name){ 'sushi' }
452
+ it "returns false if it does not find Less::More" do
453
+ Kumade::Deployer.new.more_installed?.should be_false
454
+ end
463
455
 
464
- before do
465
- subject.stub(:say)
466
- force_add_heroku_remote(environment, app_name)
456
+ it "returns true if it finds Less::More" do
457
+ module Less
458
+ class More
459
+ end
467
460
  end
461
+ Kumade::Deployer.new.more_installed?.should be_true
462
+ end
463
+ end
468
464
 
469
- after { remove_remote(environment) }
470
-
471
- it "runs db:migrate with the correct app" do
472
- subject.should_receive(:run).
473
- with("bundle exec heroku rake db:migrate --app #{app_name}")
474
- subject.should_receive(:success).with("Migrated #{app_name}")
465
+ describe Kumade::Deployer, "#heroku_migrate" do
466
+ let(:environment){ 'staging' }
467
+ let(:app_name){ 'sushi' }
475
468
 
476
- subject.heroku_migrate(environment)
477
- end
469
+ before do
470
+ subject.stub(:say)
471
+ force_add_heroku_remote(environment, app_name)
478
472
  end
479
473
 
480
- describe Deployer, "#string_present?" do
481
- it "returns false for nil" do
482
- subject.string_present?(nil).should be_false
483
- end
474
+ after { remove_remote(environment) }
484
475
 
485
- it "returns false for false" do
486
- subject.string_present?(false).should be_false
487
- end
476
+ it "runs db:migrate with the correct app" do
477
+ subject.stub(:run => true)
478
+ subject.should_receive(:heroku).
479
+ with("rake db:migrate", app_name)
480
+ subject.should_receive(:success).with("Migrated #{app_name}")
488
481
 
489
- it "returns false for true" do
490
- subject.string_present?(true).should be_false
491
- end
482
+ subject.heroku_migrate(environment)
483
+ end
484
+ end
492
485
 
493
- it "returns false for an empty string" do
494
- subject.string_present?('').should be_false
495
- end
486
+ describe Kumade::Deployer, "#ensure_heroku_remote_exists_for" do
487
+ let(:environment){ 'staging' }
488
+ let(:bad_environment){ 'bad' }
489
+ let(:staging_app_name) { 'staging-sushi' }
496
490
 
497
- it "returns true for a non-empty string" do
498
- subject.string_present?('abc').should be_true
499
- end
491
+ before do
492
+ subject.stub(:say)
493
+ force_add_heroku_remote(environment, staging_app_name)
494
+ `git remote add #{bad_environment} blerg@example.com`
500
495
  end
501
496
 
502
- describe Deployer, "#ensure_heroku_remote_exists_for" do
503
- let(:environment){ 'staging' }
504
- let(:bad_environment){ 'bad' }
505
- let(:staging_app_name) { 'staging-sushi' }
497
+ after do
498
+ remove_remote(environment)
499
+ remove_remote(bad_environment)
500
+ end
506
501
 
507
- before do
508
- subject.stub(:say)
509
- force_add_heroku_remote(environment, staging_app_name)
510
- `git remote add #{bad_environment} blerg@example.com`
511
- end
502
+ context "when the remote points to Heroku" do
503
+ it "does not print an error" do
504
+ subject.should_not_receive(:error)
512
505
 
513
- after do
514
- remove_remote(environment)
515
- remove_remote(bad_environment)
506
+ subject.ensure_heroku_remote_exists_for(environment)
516
507
  end
517
508
 
518
- context "when the remote points to Heroku" do
519
- it "does not print an error" do
520
- subject.should_not_receive(:error)
521
-
522
- subject.ensure_heroku_remote_exists_for(environment)
523
- end
524
-
525
- it "prints a success message" do
526
- subject.should_receive(:success).with("#{environment} is a Heroku remote")
509
+ it "prints a success message" do
510
+ subject.should_receive(:success).with("#{environment} is a Heroku remote")
527
511
 
528
- subject.ensure_heroku_remote_exists_for(environment)
529
- end
512
+ subject.ensure_heroku_remote_exists_for(environment)
530
513
  end
514
+ end
531
515
 
532
516
 
533
- context "when the remote does not exist" do
534
- before { remove_remote(environment) }
517
+ context "when the remote does not exist" do
518
+ before { remove_remote(environment) }
535
519
 
536
- it "prints an error" do
537
- subject.should_receive(:error).with(%{Cannot deploy: "#{environment}" remote does not exist})
520
+ it "prints an error" do
521
+ subject.should_receive(:error).with(%{Cannot deploy: "#{environment}" remote does not exist})
538
522
 
539
- subject.ensure_heroku_remote_exists_for(environment)
540
- end
523
+ subject.ensure_heroku_remote_exists_for(environment)
541
524
  end
525
+ end
542
526
 
543
- context "when the remote does not point to Heroku" do
544
- it "prints an error" do
545
- subject.should_receive(:error).with(%{Cannot deploy: "#{bad_environment}" remote does not point to Heroku})
527
+ context "when the remote does not point to Heroku" do
528
+ it "prints an error" do
529
+ subject.should_receive(:error).with(%{Cannot deploy: "#{bad_environment}" remote does not point to Heroku})
546
530
 
547
- subject.ensure_heroku_remote_exists_for(bad_environment)
548
- end
531
+ subject.ensure_heroku_remote_exists_for(bad_environment)
549
532
  end
550
533
  end
534
+ end
551
535
 
552
- describe Deployer, "#remote_exists?" do
553
- let(:remote_name){ 'staging' }
536
+ describe Kumade::Deployer, "#remote_exists?" do
537
+ let(:remote_name){ 'staging' }
554
538
 
555
- before { force_add_heroku_remote(remote_name, 'i-am-a-heroku-app') }
556
- after { remove_remote(remote_name) }
539
+ before { force_add_heroku_remote(remote_name, 'i-am-a-heroku-app') }
540
+ after { remove_remote(remote_name) }
557
541
 
558
- it "returns true if the remote exists" do
559
- subject.remote_exists?(remote_name).should be_true
560
- end
542
+ it "returns true if the remote exists" do
543
+ subject.remote_exists?(remote_name).should be_true
544
+ end
561
545
 
562
- it "returns false if the remote does not exist" do
563
- remove_remote(remote_name)
546
+ it "returns false if the remote does not exist" do
547
+ remove_remote(remote_name)
564
548
 
565
- subject.remote_exists?(remote_name).should be_false
566
- end
549
+ subject.remote_exists?(remote_name).should be_false
567
550
  end
551
+ end
552
+
553
+ describe Kumade::Deployer, "#heroku" do
554
+ let(:app_name){ 'sushi' }
568
555
 
569
- describe Deployer, "#announce" do
570
- it "exists" do
571
- subject.should respond_to(:announce)
556
+ context "when on Cedar" do
557
+ before { subject.stub(:on_cedar? => true) }
558
+ it "runs commands with `run`" do
559
+ subject.should_receive(:run_or_error).with("bundle exec heroku run rake --app #{app_name}", //)
560
+ subject.heroku("rake", app_name)
572
561
  end
573
562
  end
574
563
 
575
- describe Deployer, "#success" do
576
- it "exists" do
577
- subject.should respond_to(:success)
564
+ context "when not on Cedar" do
565
+ before { subject.stub(:on_cedar? => false) }
566
+ it "runs commands without `run`" do
567
+ subject.should_receive(:run_or_error).with("bundle exec heroku rake --app #{app_name}", //)
568
+ subject.heroku("rake", app_name)
578
569
  end
579
570
  end
571
+ end
580
572
 
581
- describe Deployer, "#error" do
582
- it "exists" do
583
- subject.should respond_to(:error)
584
- end
573
+ describe Kumade::Deployer, "#announce" do
574
+ it "exists" do
575
+ subject.should respond_to(:announce)
576
+ end
577
+ end
578
+
579
+ describe Kumade::Deployer, "#success" do
580
+ it "exists" do
581
+ subject.should respond_to(:success)
582
+ end
583
+ end
584
+
585
+ describe Kumade::Deployer, "#error" do
586
+ it "exists" do
587
+ subject.should respond_to(:error)
588
+ end
589
+ end
590
+
591
+ describe Kumade::Deployer, "#post_deploy" do
592
+ before { subject.stub(:run => true, :say => true) }
593
+
594
+ it "cleans up the deploy branch" do
595
+ subject.should_receive(:run).with('git checkout master && git branch -D deploy')
596
+ subject.post_deploy
585
597
  end
586
598
  end