diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-05-19 18:44:42 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-05-19 18:44:42 +0300 |
commit | 4555e1b21c365ed8303ffb7a3325d773c9b8bf31 (patch) | |
tree | 5423a1c7516cffe36384133ade12572cf709398d /spec/lib/gitlab/relative_positioning | |
parent | e570267f2f6b326480d284e0164a6464ba4081bc (diff) |
Add latest changes from gitlab-org/gitlab@13-12-stable-eev13.12.0-rc42
Diffstat (limited to 'spec/lib/gitlab/relative_positioning')
-rw-r--r-- | spec/lib/gitlab/relative_positioning/item_context_spec.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/lib/gitlab/relative_positioning/item_context_spec.rb b/spec/lib/gitlab/relative_positioning/item_context_spec.rb index daea8d8470d..3a469e53cb1 100644 --- a/spec/lib/gitlab/relative_positioning/item_context_spec.rb +++ b/spec/lib/gitlab/relative_positioning/item_context_spec.rb @@ -212,4 +212,20 @@ RSpec.describe Gitlab::RelativePositioning::ItemContext do end end end + + describe '#at_position' do + let_it_be(:issue) { create_issue(500) } + let_it_be(:issue_2) { create_issue(510) } + + let(:subject) { described_class.new(issue, range) } + + it 'finds the item at the specified position' do + expect(subject.at_position(500)).to eq(described_class.new(issue, range)) + expect(subject.at_position(510)).to eq(described_class.new(issue_2, range)) + end + + it 'raises InvalidPosition when the item cannot be found' do + expect { subject.at_position(501) }.to raise_error Gitlab::RelativePositioning::InvalidPosition + end + end end |