Commit 286b8ee6 authored by Bob Van Landuyt's avatar Bob Van Landuyt

Don't update milestones on boards if the feature is not available

parent 3b02f8dc
module Boards
class UpdateService < BaseService
def execute(board)
board.update(name: params[:name], milestone_id: params[:milestone_id])
params.delete(:milestone_id) unless project.feature_available?(:issue_board_milestone)
board.update(params)
end
end
end
......@@ -24,5 +24,25 @@ describe Boards::UpdateService, services: true do
expect(service.execute(board)).to eq false
end
it 'udpates the milestone with issue board milestones enabled' do
stub_licensed_features(issue_board_milestone: true)
milestone = create(:milestone, project: project)
service = described_class.new(project, double, milestone_id: milestone.id)
service.execute(board)
expect(board.reload.milestone).to eq(milestone)
end
it 'udpates the milestone with the issue board milestones feature enabled' do
stub_licensed_features(issue_board_milestone: false)
milestone = create(:milestone, project: project)
service = described_class.new(project, double, milestone_id: milestone.id)
service.execute(board)
expect(board.reload.milestone).to be_nil
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