diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-03 21:08:16 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-03 21:08:16 +0300 |
commit | e9c2bf267862e22c0770cc7b3a1ed97a8b87a7fd (patch) | |
tree | 7b778e44f210132af1233ceb8801b388ac3519f5 /spec/lib/gitlab/url_builder_spec.rb | |
parent | 946771d0b016ae92b15a60bc3290a33b94191ffe (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/gitlab/url_builder_spec.rb')
-rw-r--r-- | spec/lib/gitlab/url_builder_spec.rb | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/spec/lib/gitlab/url_builder_spec.rb b/spec/lib/gitlab/url_builder_spec.rb index 11bbf444b1d..c2eb1b4c25d 100644 --- a/spec/lib/gitlab/url_builder_spec.rb +++ b/spec/lib/gitlab/url_builder_spec.rb @@ -14,6 +14,18 @@ describe Gitlab::UrlBuilder do end end + context 'when passing a batch loaded Commit' do + it 'returns a proper URL' do + commit = BatchLoader.for(:commit).batch do |batch, loader| + batch.each { |commit| loader.call(:commit, build_stubbed(:commit)) } + end + + url = described_class.build(commit) + + expect(url).to eq "#{Settings.gitlab['url']}/#{commit.project.full_path}/-/commit/#{commit.id}" + end + end + context 'when passing an Issue' do it 'returns a proper URL' do issue = build_stubbed(:issue, iid: 42) @@ -160,7 +172,7 @@ describe Gitlab::UrlBuilder do project = build_stubbed(:project) expect { described_class.build(project) } - .to raise_error(NotImplementedError, 'No URL builder defined for Project') + .to raise_error(NotImplementedError, "No URL builder defined for #{project.inspect}") end end end |