BigW Consortium Gitlab

Validate if the lists are different when moving issues between lists

parent 997e77e7
......@@ -11,7 +11,8 @@ module Boards
private
def valid_move?
moving_from_list.present? && moving_to_list.present?
moving_from_list.present? && moving_to_list.present? &&
moving_from_list != moving_to_list
end
def moving_from_list
......
......@@ -121,5 +121,20 @@ describe Boards::Issues::MoveService, services: true do
expect(issue).to be_reopened
end
end
context 'when moving to same list' do
let(:issue) { create(:labeled_issue, project: project, labels: [bug, development]) }
let(:params) { { from_list_id: list1.id, to_list_id: list1.id } }
it 'returns false' do
expect(described_class.new(project, user, params).execute(issue)).to eq false
end
it 'keeps issues labels' do
described_class.new(project, user, params).execute(issue)
expect(issue.reload.labels).to contain_exactly(bug, development)
end
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