@@ -133,6 +133,15 @@ def setup
133133 assert_instance_of Deploy , deploy
134134 end
135135
136+ test "#trigger_deploy doesn't enqueues a deploy job when run_now is provided" do
137+ @stack . deploys . destroy_all
138+ Deploy . any_instance . expects ( :run_now! ) . once
139+
140+ last_commit = shipit_commits ( :third )
141+ deploy = @stack . trigger_deploy ( last_commit , AnonymousUser . new , run_now : true )
142+ assert_instance_of Deploy , deploy
143+ end
144+
136145 test "#trigger_deploy marks the deploy as `ignored_safeties` if the commit wasn't deployable" do
137146 last_commit = shipit_commits ( :fifth )
138147 refute_predicate last_commit , :deployable?
@@ -263,6 +272,16 @@ def setup
263272 assert @stack . active_task?
264273 end
265274
275+ test ".run_deploy_in_foreground triggers a deploy" do
276+ stack = Stack . create! ( repo_owner : 'foo' , repo_name : 'bar' , environment : 'production' )
277+ commit = shipit_commits ( :first )
278+ stack . commits << commit
279+
280+ Stack . any_instance . expects ( :trigger_deploy ) . with ( anything , anything , env : { } , force : true , run_now : true )
281+
282+ Stack . run_deploy_in_foreground ( stack : stack . to_param , revision : commit . sha )
283+ end
284+
266285 test "#active_task? is memoized" do
267286 assert_queries ( 1 ) do
268287 10 . times { @stack . active_task? }
0 commit comments