diff options
Diffstat (limited to 'spec/views/layouts')
-rw-r--r-- | spec/views/layouts/_flash.html.haml_spec.rb | 14 | ||||
-rw-r--r-- | spec/views/layouts/application.html.haml_spec.rb | 2 | ||||
-rw-r--r-- | spec/views/layouts/devise.html.haml_spec.rb | 7 | ||||
-rw-r--r-- | spec/views/layouts/devise_empty.html.haml_spec.rb | 7 | ||||
-rw-r--r-- | spec/views/layouts/fullscreen.html.haml_spec.rb | 13 | ||||
-rw-r--r-- | spec/views/layouts/nav/sidebar/_project.html.haml_spec.rb | 60 | ||||
-rw-r--r-- | spec/views/layouts/signup_onboarding.html.haml_spec.rb | 7 | ||||
-rw-r--r-- | spec/views/layouts/simple_registration.html.haml_spec.rb | 7 | ||||
-rw-r--r-- | spec/views/layouts/terms.html.haml_spec.rb | 13 |
9 files changed, 81 insertions, 49 deletions
diff --git a/spec/views/layouts/_flash.html.haml_spec.rb b/spec/views/layouts/_flash.html.haml_spec.rb index 82c06feb4fb..a4bed09368f 100644 --- a/spec/views/layouts/_flash.html.haml_spec.rb +++ b/spec/views/layouts/_flash.html.haml_spec.rb @@ -9,7 +9,11 @@ RSpec.describe 'layouts/_flash' do end describe 'closable flash messages' do - %w(alert notice success).each do |flash_type| + where(:flash_type) do + %w[alert notice success] + end + + with_them do let(:flash) { { flash_type => 'This is a closable flash message' } } it 'shows a close button' do @@ -19,10 +23,14 @@ RSpec.describe 'layouts/_flash' do end describe 'non closable flash messages' do - %w(error message toast warning).each do |flash_type| + where(:flash_type) do + %w[error message toast warning] + end + + with_them do let(:flash) { { flash_type => 'This is a non closable flash message' } } - it 'shows a close button' do + it 'does not show a close button' do expect(rendered).not_to include('js-close-icon') end end diff --git a/spec/views/layouts/application.html.haml_spec.rb b/spec/views/layouts/application.html.haml_spec.rb index 0f359219718..30c27078ad8 100644 --- a/spec/views/layouts/application.html.haml_spec.rb +++ b/spec/views/layouts/application.html.haml_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe 'layouts/application' do +RSpec.describe 'layouts/application', :themed_layout do let(:user) { create(:user) } before do diff --git a/spec/views/layouts/devise.html.haml_spec.rb b/spec/views/layouts/devise.html.haml_spec.rb new file mode 100644 index 00000000000..e69cf93cfb4 --- /dev/null +++ b/spec/views/layouts/devise.html.haml_spec.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe 'layouts/devise' do + it_behaves_like 'a layout which reflects the application theme setting' +end diff --git a/spec/views/layouts/devise_empty.html.haml_spec.rb b/spec/views/layouts/devise_empty.html.haml_spec.rb new file mode 100644 index 00000000000..06d742e74dd --- /dev/null +++ b/spec/views/layouts/devise_empty.html.haml_spec.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe 'layouts/devise_empty' do + it_behaves_like 'a layout which reflects the application theme setting' +end diff --git a/spec/views/layouts/fullscreen.html.haml_spec.rb b/spec/views/layouts/fullscreen.html.haml_spec.rb new file mode 100644 index 00000000000..0ae2c76ebcb --- /dev/null +++ b/spec/views/layouts/fullscreen.html.haml_spec.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe 'layouts/fullscreen' do + let_it_be(:user) { create(:user) } + + before do + allow(view).to receive(:current_user_mode).and_return(Gitlab::Auth::CurrentUserMode.new(user)) + end + + it_behaves_like 'a layout which reflects the application theme setting' +end diff --git a/spec/views/layouts/nav/sidebar/_project.html.haml_spec.rb b/spec/views/layouts/nav/sidebar/_project.html.haml_spec.rb index 3943355bffd..9ae3f814679 100644 --- a/spec/views/layouts/nav/sidebar/_project.html.haml_spec.rb +++ b/spec/views/layouts/nav/sidebar/_project.html.haml_spec.rb @@ -419,50 +419,6 @@ RSpec.describe 'layouts/nav/sidebar/_project' do end end - describe 'Logs' do - it 'has a link to the pod logs page' do - render - - expect(rendered).to have_link('Logs', href: project_logs_path(project)) - end - - describe 'when the user does not have access' do - let(:user) { nil } - - it 'does not have a link to the pod logs page' do - render - - expect(rendered).not_to have_link('Logs') - end - end - end - - describe 'Tracing' do - it 'has a link to the tracing page' do - render - - expect(rendered).to have_link('Tracing', href: project_tracing_path(project)) - end - - context 'without project.tracing_external_url' do - it 'has a link to the tracing page' do - render - - expect(rendered).to have_link('Tracing', href: project_tracing_path(project)) - end - end - - describe 'when the user does not have access' do - let(:user) { nil } - - it 'does not have a link to the tracing page' do - render - - expect(rendered).not_to have_text 'Tracing' - end - end - end - describe 'Error Tracking' do it 'has a link to the error tracking page' do render @@ -576,7 +532,7 @@ RSpec.describe 'layouts/nav/sidebar/_project' do describe 'Google Cloud' do it 'has a link to the google cloud page' do render - expect(rendered).to have_link('Google Cloud', href: project_google_cloud_index_path(project)) + expect(rendered).to have_link('Google Cloud', href: project_google_cloud_configuration_path(project)) end describe 'when the user does not have access' do @@ -953,8 +909,11 @@ RSpec.describe 'layouts/nav/sidebar/_project' do end describe 'Packages & Registries' do + let(:packages_enabled) { false } + before do stub_container_registry_config(enabled: registry_enabled) + stub_config(packages: { enabled: packages_enabled }) end context 'when registry is enabled' do @@ -976,6 +935,17 @@ RSpec.describe 'layouts/nav/sidebar/_project' do expect(rendered).not_to have_link('Packages & Registries', href: project_settings_packages_and_registries_path(project)) end end + + context 'when packages config is enabled' do + let(:registry_enabled) { false } + let(:packages_enabled) { true } + + it 'has a link to the Packages & Registries settings' do + render + + expect(rendered).to have_link('Packages & Registries', href: project_settings_packages_and_registries_path(project)) + end + end end describe 'Usage Quotas' do diff --git a/spec/views/layouts/signup_onboarding.html.haml_spec.rb b/spec/views/layouts/signup_onboarding.html.haml_spec.rb new file mode 100644 index 00000000000..8748c673616 --- /dev/null +++ b/spec/views/layouts/signup_onboarding.html.haml_spec.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe 'layouts/signup_onboarding' do + it_behaves_like 'a layout which reflects the application theme setting' +end diff --git a/spec/views/layouts/simple_registration.html.haml_spec.rb b/spec/views/layouts/simple_registration.html.haml_spec.rb new file mode 100644 index 00000000000..98553a12ad8 --- /dev/null +++ b/spec/views/layouts/simple_registration.html.haml_spec.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe 'layouts/simple_registration' do + it_behaves_like 'a layout which reflects the application theme setting' +end diff --git a/spec/views/layouts/terms.html.haml_spec.rb b/spec/views/layouts/terms.html.haml_spec.rb new file mode 100644 index 00000000000..520882449c5 --- /dev/null +++ b/spec/views/layouts/terms.html.haml_spec.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe 'layouts/terms' do + let_it_be(:user) { create(:user) } + + before do + allow(view).to receive(:current_user_mode).and_return(Gitlab::Auth::CurrentUserMode.new(user)) + end + + it_behaves_like 'a layout which reflects the application theme setting' +end |