Commit 99f05339 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Fix milestone specs and group policy

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent f5ea25aa
......@@ -34,6 +34,12 @@ class GroupPolicy < BasePolicy
if globally_viewable && @subject.request_access_enabled && !member
can! :request_access
end
# EE-only
if @subject.ldap_synced?
cannot! :admin_group_member
can! :override_group_member if master
end
end
def can_read_group?
......@@ -45,11 +51,4 @@ class GroupPolicy < BasePolicy
GroupProjectsFinder.new(@subject).execute(@user).any?
end
def additional_rules!(master)
if @subject.ldap_synced?
cannot! :admin_group_member
can! :override_group_member if master
end
end
end
......@@ -9,33 +9,6 @@ feature 'Project milestone', :feature do
login_as(user)
end
context 'milestone summary' do
let(:project) { create(:empty_project, :public) }
let(:milestone) { create(:milestone, project: project) }
it 'shows the total weight when sum is greater than zero' do
create(:issue, project: project, milestone: milestone, weight: 3)
create(:issue, project: project, milestone: milestone, weight: 1)
visit milestone_path
within '.milestone-summary' do
expect(page).to have_content 'Total weight: 4'
end
end
it 'hides the total weight when sum is equal to zero' do
create(:issue, project: project, milestone: milestone, weight: nil)
create(:issue, project: project, milestone: milestone, weight: nil)
visit milestone_path
within '.milestone-summary' do
expect(page).not_to have_content 'Total weight:'
end
end
end
context 'when project has enabled issues' do
before do
visit milestone_path
......@@ -89,7 +62,33 @@ feature 'Project milestone', :feature do
end
end
# EE-only
context 'milestone summary' do
it 'shows the total weight when sum is greater than zero' do
create(:issue, project: project, milestone: milestone, weight: 3)
create(:issue, project: project, milestone: milestone, weight: 1)
visit milestone_path
within '.milestone-summary' do
expect(page).to have_content 'Total weight: 4'
end
end
it 'hides the total weight when sum is equal to zero' do
create(:issue, project: project, milestone: milestone, weight: nil)
create(:issue, project: project, milestone: milestone, weight: nil)
visit milestone_path
within '.milestone-summary' do
expect(page).not_to have_content 'Total weight:'
end
end
end
# EE-only
def milestone_path
visit namespace_project_milestone_path(project.namespace, project, milestone)
namespace_project_milestone_path(project.namespace, project, milestone)
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