Commit a0108c69 authored by Valery Sizov's avatar Valery Sizov

Address review comments

parent 710e4df9
...@@ -58,9 +58,9 @@ module Issues ...@@ -58,9 +58,9 @@ module Issues
end end
def handle_move_between_iids(issue) def handle_move_between_iids(issue)
return unless move_between_iids = params.delete(:move_between_iids) return unless params[:move_between_iids]
after_iid, before_iid = move_between_iids after_iid, before_iid = params.delete(:move_between_iids)
issue_before = get_issue_if_allowed(issue.project, before_iid) if before_iid issue_before = get_issue_if_allowed(issue.project, before_iid) if before_iid
issue_after = get_issue_if_allowed(issue.project, after_iid) if after_iid issue_after = get_issue_if_allowed(issue.project, after_iid) if after_iid
......
...@@ -4,6 +4,7 @@ describe Issue, 'RelativePositioning' do ...@@ -4,6 +4,7 @@ describe Issue, 'RelativePositioning' do
let(:project) { create(:empty_project) } let(:project) { create(:empty_project) }
let(:issue) { create(:issue, project: project) } let(:issue) { create(:issue, project: project) }
let(:issue1) { create(:issue, project: project) } let(:issue1) { create(:issue, project: project) }
let(:new_issue) { create(:issue, project: project) }
before do before do
[issue, issue1].each do |issue| [issue, issue1].each do |issue|
...@@ -36,8 +37,6 @@ describe Issue, 'RelativePositioning' do ...@@ -36,8 +37,6 @@ describe Issue, 'RelativePositioning' do
describe '#move_to_end' do describe '#move_to_end' do
it 'moves issue to the end' do it 'moves issue to the end' do
new_issue = create :issue, project: project
new_issue.move_to_end new_issue.move_to_end
expect(new_issue.relative_position).to be > issue1.relative_position expect(new_issue.relative_position).to be > issue1.relative_position
...@@ -46,8 +45,6 @@ describe Issue, 'RelativePositioning' do ...@@ -46,8 +45,6 @@ describe Issue, 'RelativePositioning' do
describe '#move_between' do describe '#move_between' do
it 'positions issue between two other' do it 'positions issue between two other' do
new_issue = create :issue, project: project
new_issue.move_between(issue, issue1) new_issue.move_between(issue, issue1)
expect(new_issue.relative_position).to be > issue.relative_position expect(new_issue.relative_position).to be > issue.relative_position
...@@ -55,23 +52,18 @@ describe Issue, 'RelativePositioning' do ...@@ -55,23 +52,18 @@ describe Issue, 'RelativePositioning' do
end end
it 'positions issue between on top' do it 'positions issue between on top' do
new_issue = create :issue, project: project
new_issue.move_between(nil, issue) new_issue.move_between(nil, issue)
expect(new_issue.relative_position).to be < issue.relative_position expect(new_issue.relative_position).to be < issue.relative_position
end end
it 'positions issue between to end' do it 'positions issue between to end' do
new_issue = create :issue, project: project
new_issue.move_between(issue1, nil) new_issue.move_between(issue1, nil)
expect(new_issue.relative_position).to be > issue1.relative_position expect(new_issue.relative_position).to be > issue1.relative_position
end end
it 'positions issues even when after and before positions are the same' do it 'positions issues even when after and before positions are the same' do
new_issue = create :issue, project: project
issue1.update relative_position: issue.relative_position issue1.update relative_position: issue.relative_position
new_issue.move_between(issue, issue1) new_issue.move_between(issue, issue1)
......
...@@ -98,7 +98,7 @@ describe Boards::Issues::MoveService, services: true do ...@@ -98,7 +98,7 @@ describe Boards::Issues::MoveService, services: true do
issue.move_between!(issue1, issue2) issue.move_between!(issue1, issue2)
params.merge! move_after_iid: issue.iid, move_before_iid: issue2.iid params.merge!(move_after_iid: issue.iid, move_before_iid: issue2.iid)
described_class.new(project, user, params).execute(issue1) described_class.new(project, user, params).execute(issue1)
......
...@@ -59,8 +59,8 @@ describe Issues::UpdateService, services: true do ...@@ -59,8 +59,8 @@ describe Issues::UpdateService, services: true do
end end
it 'sorts issues as specified by parameters' do it 'sorts issues as specified by parameters' do
issue1 = create :issue, project: project, assignee_id: user3.id issue1 = create(:issue, project: project, assignee_id: user3.id)
issue2 = create :issue, project: project, assignee_id: user3.id issue2 = create(:issue, project: project, assignee_id: user3.id)
[issue, issue1, issue2].each do |issue| [issue, issue1, issue2].each do |issue|
issue.move_to_end issue.move_to_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