summaryrefslogtreecommitdiff
path: root/spec/controllers
diff options
context:
space:
mode:
authorChantal Rollison <crollison@gitlab.com>2018-09-10 17:37:21 -0700
committerChantal Rollison <crollison@gitlab.com>2018-09-13 08:08:53 -0700
commite580c2261d12b4542eafba6b5db3b3656d57ed63 (patch)
treea175ed72fc13c64886952424e084f9b32742fcb0 /spec/controllers
parentc7d1eef671dbf598814a6c2ff1f81b924583ae8a (diff)
downloadgitlab-ce-e580c2261d12b4542eafba6b5db3b3656d57ed63.tar.gz
Filter group milestones based on user membership
Diffstat (limited to 'spec/controllers')
-rw-r--r--spec/controllers/dashboard/milestones_controller_spec.rb8
1 files changed, 5 insertions, 3 deletions
diff --git a/spec/controllers/dashboard/milestones_controller_spec.rb b/spec/controllers/dashboard/milestones_controller_spec.rb
index 505c040b5d5..56047c0c8d2 100644
--- a/spec/controllers/dashboard/milestones_controller_spec.rb
+++ b/spec/controllers/dashboard/milestones_controller_spec.rb
@@ -3,9 +3,11 @@ require 'spec_helper'
describe Dashboard::MilestonesController do
let(:project) { create(:project) }
let(:group) { create(:group) }
+ let(:public_group) { create(:group, :public) }
let(:user) { create(:user) }
let(:project_milestone) { create(:milestone, project: project) }
let(:group_milestone) { create(:milestone, group: group) }
+ let!(:public_milestone) { create(:milestone, group: public_group) }
let(:milestone) do
DashboardMilestone.build(
[project],
@@ -43,13 +45,13 @@ describe Dashboard::MilestonesController do
end
describe "#index" do
- it 'should contain group and project milestones' do
+ it 'returns group and project milestones to which the user belongs' do
get :index, format: :json
expect(response).to have_gitlab_http_status(200)
expect(json_response.size).to eq(2)
- expect(json_response.map { |i| i["first_milestone"]["id"] }).to include(group_milestone.id, project_milestone.id)
- expect(json_response.map { |i| i["group_name"] }).to include(group.name)
+ expect(json_response.map { |i| i["first_milestone"]["id"] }).to match_array([group_milestone.id, project_milestone.id])
+ expect(json_response.map { |i| i["group_name"] }.compact).to match_array(group.name)
end
end
end