Commit 88b03bb5 authored by Z.J. van de Weg's avatar Z.J. van de Weg

Rename method in test

parent 58368fbc
...@@ -404,7 +404,9 @@ class Projects::MergeRequestsController < Projects::ApplicationController ...@@ -404,7 +404,9 @@ class Projects::MergeRequestsController < Projects::ApplicationController
end end
def ci_environments_status def ci_environments_status
render json: @merge_request.environments.map do |environment| environments =
begin
@merge_request.environments.map do |environment|
next unless can?(current_user, :read_environment, environment) next unless can?(current_user, :read_environment, environment)
deployment = environment.first_deployment_for(@merge_request.diff_head_commit) deployment = environment.first_deployment_for(@merge_request.diff_head_commit)
...@@ -429,6 +431,9 @@ class Projects::MergeRequestsController < Projects::ApplicationController ...@@ -429,6 +431,9 @@ class Projects::MergeRequestsController < Projects::ApplicationController
end.compact end.compact
end end
render json: environments
end
protected protected
def selected_target_project def selected_target_project
......
...@@ -83,4 +83,9 @@ Rails.application.routes.draw do ...@@ -83,4 +83,9 @@ Rails.application.routes.draw do
draw :group draw :group
draw :user draw :user
draw :project draw :project
# Get all keys of user
get ':username.keys' => 'profiles/keys#get_keys', constraints: { username: /.*/ }
root to: "root#index"
end end
...@@ -64,7 +64,7 @@ describe Environment, models: true do ...@@ -64,7 +64,7 @@ describe Environment, models: true do
end end
end end
describe '#deployment_id_for' do describe '#first_deployment_for' do
let(:project) { create(:project) } let(:project) { create(:project) }
let!(:environment) { create(:environment, project: project) } let!(:environment) { create(:environment, project: project) }
let!(:deployment) { create(:deployment, environment: environment, ref: commit.parent.id) } let!(:deployment) { create(:deployment, environment: environment, ref: commit.parent.id) }
...@@ -73,11 +73,11 @@ describe Environment, models: true do ...@@ -73,11 +73,11 @@ describe Environment, models: true do
let(:commit) { project.commit.parent } let(:commit) { project.commit.parent }
it 'returns deployment id for the environment' do it 'returns deployment id for the environment' do
expect(environment.deployment_id_for(commit)).to eq deployment1.id expect(environment.first_deployment_for(commit)).to eq deployment1
end end
it 'return nil when no deployment is found' do it 'return nil when no deployment is found' do
expect(environment.deployment_id_for(head_commit)).to eq nil expect(environment.first_deployment_for(head_commit)).to eq nil
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment