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/views | |
parent | 0bdb61ade7f12067dd524463af4f83994f1baa37 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/views')
-rw-r--r-- | spec/views/projects/tree/show.html.haml_spec.rb | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/spec/views/projects/tree/show.html.haml_spec.rb b/spec/views/projects/tree/show.html.haml_spec.rb index 5a1ae715f8f..942c352c6b6 100644 --- a/spec/views/projects/tree/show.html.haml_spec.rb +++ b/spec/views/projects/tree/show.html.haml_spec.rb @@ -5,7 +5,7 @@ require 'spec_helper' RSpec.describe 'projects/tree/show' do include Devise::Test::ControllerHelpers - let(:project) { create(:project, :repository) } + let_it_be(:project) { create(:project, :repository, create_branch: 'bar') } let(:repository) { project.repository } let(:ref) { 'master' } let(:commit) { repository.commit(ref) } @@ -38,4 +38,24 @@ RSpec.describe 'projects/tree/show' do expect(rendered).to have_css('#js-tree-ref-switcher') end end + + context 'when on root ref' do + let(:ref) { repository.root_ref } + + it 'hides compare button' do + render + + expect(rendered).not_to include('Compare') + end + end + + context 'when not on root ref' do + let(:ref) { 'bar' } + + it 'shows a compare button' do + render + + expect(rendered).to include('Compare') + end + end end |