2017-09-10 17:25:29 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe Dashboard::MilestonesController do
|
|
|
|
let(:project) { create(:project) }
|
2018-11-18 11:00:15 +05:30
|
|
|
let(:group) { create(:group) }
|
|
|
|
let(:user) { create(:user) }
|
2017-09-10 17:25:29 +05:30
|
|
|
let(:project_milestone) { create(:milestone, project: project) }
|
2018-11-18 11:00:15 +05:30
|
|
|
let(:group_milestone) { create(:milestone, group: group) }
|
2017-09-10 17:25:29 +05:30
|
|
|
let(:milestone) do
|
|
|
|
DashboardMilestone.build(
|
|
|
|
[project],
|
|
|
|
project_milestone.title
|
|
|
|
)
|
|
|
|
end
|
|
|
|
let(:issue) { create(:issue, project: project, milestone: project_milestone) }
|
2018-11-18 11:00:15 +05:30
|
|
|
let(:group_issue) { create(:issue, milestone: group_milestone) }
|
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
let!(:label) { create(:label, project: project, title: 'Issue Label', issues: [issue]) }
|
2018-11-18 11:00:15 +05:30
|
|
|
let!(:group_label) { create(:group_label, group: group, title: 'Group Issue Label', issues: [group_issue]) }
|
2017-09-10 17:25:29 +05:30
|
|
|
let!(:merge_request) { create(:merge_request, source_project: project, target_project: project, milestone: project_milestone) }
|
|
|
|
let(:milestone_path) { dashboard_milestone_path(milestone.safe_title, title: milestone.title) }
|
|
|
|
|
|
|
|
before do
|
|
|
|
sign_in(user)
|
2018-11-18 11:00:15 +05:30
|
|
|
project.add_maintainer(user)
|
|
|
|
group.add_developer(user)
|
2017-09-10 17:25:29 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
it_behaves_like 'milestone tabs'
|
|
|
|
|
|
|
|
describe "#show" do
|
|
|
|
render_views
|
|
|
|
|
|
|
|
def view_milestone
|
|
|
|
get :show, id: milestone.safe_title, title: milestone.title
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'shows milestone page' do
|
|
|
|
view_milestone
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
expect(response).to have_gitlab_http_status(200)
|
2017-09-10 17:25:29 +05:30
|
|
|
end
|
|
|
|
end
|
2018-11-18 11:00:15 +05:30
|
|
|
|
|
|
|
describe "#index" do
|
|
|
|
it 'should contain group and project milestones' 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)
|
|
|
|
end
|
|
|
|
end
|
2017-09-10 17:25:29 +05:30
|
|
|
end
|