diff options
Diffstat (limited to 'spec/views/projects/tree/show.html.haml_spec.rb')
-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 |