Skip to content

Commit

Permalink
fix invalid link to new deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
grosser committed Mar 10, 2015
1 parent ecfcbcf commit 2e48aa7
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/helpers/releases_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ def release_label(project, release)
end

def link_to_deploy_stage(stage, release)
deploy_params = { reference: release.version, stage_id: stage.id }
deploy_params = { reference: release.version }

if stage.confirm_before_deploying?
link_to stage.name, new_project_deploy_path(@project, deploy_params)
link_to stage.name, new_project_stage_deploy_path(@project, stage, deploy_params)
else
link_to stage.name, project_deploys_path(@project, deploy: deploy_params), method: :post
end
Expand Down
18 changes: 18 additions & 0 deletions test/helpers/releases_helper_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
require_relative '../test_helper'

describe ReleasesHelper do
describe "#link_to_deploy_stage" do
let(:stage) { stages(:test_staging) }
let(:release) { Release.new }
before { @project = stage.project } # ugly ...

it "links to a new deploy when it needs to be confirmed" do
stage.confirm = true
link_to_deploy_stage(stage, release).must_include "/projects/foo/stages/staging/deploys/new?"
end

it "links creating a deploy when it does not needs to be confirmed" do
link_to_deploy_stage(stage, release).must_include "/projects/foo/deploys?"
end
end
end

0 comments on commit 2e48aa7

Please sign in to comment.