Commit 63fa46cd authored by Sean Arnold's avatar Sean Arnold

Minor stylistic tweaks

parent c89fb511
...@@ -5,7 +5,7 @@ module IncidentManagement ...@@ -5,7 +5,7 @@ module IncidentManagement
class CreateService class CreateService
# @param schedule [IncidentManagement::OncallSchedule] # @param schedule [IncidentManagement::OncallSchedule]
# @param project [Project] # @param project [Project]
# @param user [User] # @param current_user [User]
# @param params [Hash<Symbol,Any>] # @param params [Hash<Symbol,Any>]
# @param params - name [String] The name of the on-call rotation. # @param params - name [String] The name of the on-call rotation.
# @param params - length [Integer] The length of the rotation. # @param params - length [Integer] The length of the rotation.
...@@ -15,10 +15,10 @@ module IncidentManagement ...@@ -15,10 +15,10 @@ module IncidentManagement
# @option opts - participant [User] The user who is part of the rotation # @option opts - participant [User] The user who is part of the rotation
# @option opts - color_palette [String] The color palette to assign to the on-call user, for example: "blue". # @option opts - color_palette [String] The color palette to assign to the on-call user, for example: "blue".
# @option opts - color_weight [String] The color weight to assign to for the on-call user, for example "500". Max 4 chars. # @option opts - color_weight [String] The color weight to assign to for the on-call user, for example "500". Max 4 chars.
def initialize(schedule, project, user, params) def initialize(schedule, project, current_user, params)
@schedule = schedule @schedule = schedule
@project = project @project = project
@current_user = user @current_user = current_user
@params = params @params = params
end end
...@@ -53,8 +53,7 @@ module IncidentManagement ...@@ -53,8 +53,7 @@ module IncidentManagement
end end
def available? def available?
Feature.enabled?(:oncall_schedules_mvc, project) && ::Gitlab::IncidentManagement.oncall_schedules_available?(project)
project.feature_available?(:oncall_schedules)
end end
def error(message) def error(message)
......
...@@ -12,6 +12,7 @@ RSpec.describe IncidentManagement::OncallRotationPolicy do ...@@ -12,6 +12,7 @@ RSpec.describe IncidentManagement::OncallRotationPolicy do
before do before do
stub_feature_flags(oncall_schedules_mvc: project) stub_feature_flags(oncall_schedules_mvc: project)
stub_licensed_features(oncall_schedules: true)
end end
describe 'rules' do describe 'rules' do
...@@ -22,14 +23,14 @@ RSpec.describe IncidentManagement::OncallRotationPolicy do ...@@ -22,14 +23,14 @@ RSpec.describe IncidentManagement::OncallRotationPolicy do
project.add_reporter(user) project.add_reporter(user)
end end
it { is_expected.to be_disallowed :read_incident_management_oncall_schedule } it { is_expected.to be_allowed :read_incident_management_oncall_schedule }
context 'licensed feature enabled' do context 'licensed feature disabled' do
before do before do
stub_licensed_features(oncall_schedules: true) stub_licensed_features(oncall_schedules: false)
end end
it { is_expected.to be_allowed :read_incident_management_oncall_schedule } it { is_expected.to be_disallowed :read_incident_management_oncall_schedule }
end end
end end
end end
......
...@@ -5,7 +5,6 @@ require 'spec_helper' ...@@ -5,7 +5,6 @@ require 'spec_helper'
RSpec.describe IncidentManagement::OncallRotations::CreateService do RSpec.describe IncidentManagement::OncallRotations::CreateService do
let_it_be_with_refind(:project) { create(:project) } let_it_be_with_refind(:project) { create(:project) }
let_it_be(:schedule) { create(:incident_management_oncall_schedule, project: project) } let_it_be(:schedule) { create(:incident_management_oncall_schedule, project: project) }
let_it_be(:user_with_permissions) { create(:user) } let_it_be(:user_with_permissions) { create(:user) }
let_it_be(:user_without_permissions) { create(:user) } let_it_be(:user_without_permissions) { create(:user) }
let_it_be(:current_user) { user_with_permissions } let_it_be(:current_user) { user_with_permissions }
......
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