diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-09-22 06:10:15 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-09-22 06:10:15 +0300 |
commit | 1e69e818f0f6d3598efb67104c39ec9408570b0f (patch) | |
tree | 1dbb70f80d2a63e1a1aa2f282e8ab8e08edaee89 /spec/presenters | |
parent | 0bdb61ade7f12067dd524463af4f83994f1baa37 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/presenters')
-rw-r--r-- | spec/presenters/tree_entry_presenter_spec.rb | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/spec/presenters/tree_entry_presenter_spec.rb b/spec/presenters/tree_entry_presenter_spec.rb index 0abf372b704..359ffbcb140 100644 --- a/spec/presenters/tree_entry_presenter_spec.rb +++ b/spec/presenters/tree_entry_presenter_spec.rb @@ -7,29 +7,32 @@ RSpec.describe TreeEntryPresenter do let(:project) { create(:project, :repository) } let(:repository) { project.repository } - let(:tree) { Gitlab::Graphql::Representation::TreeEntry.new(repository.tree.trees.first, repository) } + let(:tree) { Gitlab::Graphql::Representation::TreeEntry.new(repository.tree(ref).trees.first, repository) } let(:presenter) { described_class.new(tree) } + let(:ref) { 'master' } describe '.web_url' do - it { expect(presenter.web_url).to eq("http://localhost/#{project.full_path}/-/tree/#{tree.commit_id}/#{tree.path}") } + it { + expect(presenter.web_url).to eq("http://localhost/#{project.full_path}/-/tree/#{ref}/#{tree.path}") + } end describe '#web_path' do - it { expect(presenter.web_path).to eq("/#{project.full_path}/-/tree/#{tree.commit_id}/#{tree.path}") } + it { expect(presenter.web_path).to eq("/#{project.full_path}/-/tree/#{ref}/#{tree.path}") } end - context 'when blob has ref_type' do + context 'when tree 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") } + it { expect(presenter.web_url).to eq("http://localhost/#{project.full_path}/-/tree/#{ref}/#{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") + expect(presenter.web_path).to eq("/#{project.full_path}/-/tree/#{ref}/#{tree.path}?ref_type=heads") } end end |