diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-06-14 18:09:43 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-06-14 18:09:43 +0300 |
commit | 7a33080fff9a735cbe77968d67b13ffa92c0ffae (patch) | |
tree | 71a880649c8d3e551ec6bd94e93d08a9a9b5bde7 /spec/presenters | |
parent | 9223573b85bcfdd21953f52e0d2c5cb587e366a1 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/presenters')
-rw-r--r-- | spec/presenters/blob_presenter_spec.rb | 26 | ||||
-rw-r--r-- | spec/presenters/tree_entry_presenter_spec.rb | 16 |
2 files changed, 42 insertions, 0 deletions
diff --git a/spec/presenters/blob_presenter_spec.rb b/spec/presenters/blob_presenter_spec.rb index f10150b819a..e776716bd2d 100644 --- a/spec/presenters/blob_presenter_spec.rb +++ b/spec/presenters/blob_presenter_spec.rb @@ -31,6 +31,32 @@ RSpec.describe BlobPresenter do it { expect(presenter.replace_path).to eq("/#{project.full_path}/-/update/#{blob.commit_id}/#{blob.path}") } end + context 'when blob has ref_type' do + before do + blob.ref_type = 'heads' + end + + describe '#web_url' do + it { expect(presenter.web_url).to eq("http://localhost/#{project.full_path}/-/blob/#{blob.commit_id}/#{blob.path}?ref_type=heads") } + end + + describe '#web_path' do + it { expect(presenter.web_path).to eq("/#{project.full_path}/-/blob/#{blob.commit_id}/#{blob.path}?ref_type=heads") } + end + + describe '#edit_blob_path' do + it { expect(presenter.edit_blob_path).to eq("/#{project.full_path}/-/edit/#{blob.commit_id}/#{blob.path}?ref_type=heads") } + end + + describe '#raw_path' do + it { expect(presenter.raw_path).to eq("/#{project.full_path}/-/raw/#{blob.commit_id}/#{blob.path}?ref_type=heads") } + end + + describe '#replace_path' do + it { expect(presenter.replace_path).to eq("/#{project.full_path}/-/update/#{blob.commit_id}/#{blob.path}?ref_type=heads") } + end + end + describe '#can_current_user_push_to_branch' do let(:branch_exists) { true } diff --git a/spec/presenters/tree_entry_presenter_spec.rb b/spec/presenters/tree_entry_presenter_spec.rb index de84f36c5e6..0abf372b704 100644 --- a/spec/presenters/tree_entry_presenter_spec.rb +++ b/spec/presenters/tree_entry_presenter_spec.rb @@ -17,4 +17,20 @@ RSpec.describe TreeEntryPresenter do describe '#web_path' do it { expect(presenter.web_path).to eq("/#{project.full_path}/-/tree/#{tree.commit_id}/#{tree.path}") } end + + context 'when blob has ref_type' do + before do + tree.ref_type = 'heads' + end + + describe '.web_url' do + it { expect(presenter.web_url).to eq("http://localhost/#{project.full_path}/-/tree/#{tree.commit_id}/#{tree.path}?ref_type=heads") } + end + + describe '#web_path' do + it { + expect(presenter.web_path).to eq("/#{project.full_path}/-/tree/#{tree.commit_id}/#{tree.path}?ref_type=heads") + } + end + end end |