Skip to content

Commit

Permalink
fail decriptively when requested group was not found
Browse files Browse the repository at this point in the history
  • Loading branch information
grosser committed Dec 12, 2017
1 parent 94ccf11 commit 12a1028
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,15 @@ def destroy
end

def preview
deploy_groups = DeployGroup.all
deploy_groups = @deploy_group.where(permalink: params[:deploy_group]) if params[:deploy_group].present?

if params[:group_id]
@group = EnvironmentVariableGroup.find(params[:group_id])
deploy_groups =
if deploy_group = params[:deploy_group].presence
[DeployGroup.find_by_permalink!(deploy_group)]
else
DeployGroup.all
end

if group_id = params[:group_id]
@group = EnvironmentVariableGroup.find(group_id)
@project = Project.new(environment_variable_groups: [@group])
else
@project = Project.find(params[:project_id])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,12 @@ def self.it_destroys
[".pod2", {"X" => "Y", "Y" => "Z"}]
]
end

it "fails when deploy group is unknown" do
assert_raises ActiveRecord::RecordNotFound do
get :preview, params: {group_id: env_group.id, project_id: project.id, deploy_group: "pod23" }, format: :json
end
end
end
end

Expand Down

0 comments on commit 12a1028

Please sign in to comment.