diff options
author | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2018-10-19 16:41:40 +0300 |
---|---|---|
committer | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2018-10-19 16:41:40 +0300 |
commit | 80cce65d7e77088c96305906e8c7637d303a3ce5 (patch) | |
tree | ffe948936ba0402fd51d1fc03a87b43258859238 /spec/models | |
parent | ce6a21f742051271ae5e55795fead023f1a73068 (diff) | |
parent | c871faa3e42edf7c1d92669cf18a5b0de7c84ace (diff) |
Merge branch 'ccr/43034_issues_controller_100_queries' into 'master'
Add preload for routes and namespaces for issues controller.
Closes #43034
See merge request gitlab-org/gitlab-ce!21651
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/concerns/relative_positioning_spec.rb | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/spec/models/concerns/relative_positioning_spec.rb b/spec/models/concerns/relative_positioning_spec.rb index 729056b6abc..66c1f47d12b 100644 --- a/spec/models/concerns/relative_positioning_spec.rb +++ b/spec/models/concerns/relative_positioning_spec.rb @@ -6,9 +6,13 @@ describe RelativePositioning do let(:issue1) { create(:issue, project: project) } let(:new_issue) { create(:issue, project: project) } - before do - [issue, issue1].each do |issue| - issue.move_to_end && issue.save + describe '.move_to_end' do + it 'moves the object to the end' do + Issue.move_to_end([issue, issue1]) + + expect(issue1.prev_relative_position).to eq issue.relative_position + expect(issue.prev_relative_position).to eq nil + expect(issue1.next_relative_position).to eq nil end end @@ -59,6 +63,12 @@ describe RelativePositioning do end describe '#move_to_end' do + before do + [issue, issue1].each do |issue| + issue.move_to_end && issue.save + end + end + it 'moves issue to the end' do new_issue.move_to_end @@ -67,6 +77,12 @@ describe RelativePositioning do end describe '#shift_after?' do + before do + [issue, issue1].each do |issue| + issue.move_to_end && issue.save + end + end + it 'returns true' do issue.update(relative_position: issue1.relative_position - 1) @@ -81,6 +97,12 @@ describe RelativePositioning do end describe '#shift_before?' do + before do + [issue, issue1].each do |issue| + issue.move_to_end && issue.save + end + end + it 'returns true' do issue.update(relative_position: issue1.relative_position + 1) @@ -95,6 +117,12 @@ describe RelativePositioning do end describe '#move_between' do + before do + [issue, issue1].each do |issue| + issue.move_to_end && issue.save + end + end + it 'positions issue between two other' do new_issue.move_between(issue, issue1) |