diff options
Diffstat (limited to 'spec/views/admin')
8 files changed, 53 insertions, 7 deletions
diff --git a/spec/views/admin/application_settings/_eks.html.haml_spec.rb b/spec/views/admin/application_settings/_eks.html.haml_spec.rb index 52434557d3a..2f45eaadc9f 100644 --- a/spec/views/admin/application_settings/_eks.html.haml_spec.rb +++ b/spec/views/admin/application_settings/_eks.html.haml_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe 'admin/application_settings/_eks' do +RSpec.describe 'admin/application_settings/_eks' do let_it_be(:admin) { create(:admin) } let(:page) { Capybara::Node::Simple.new(rendered) } diff --git a/spec/views/admin/application_settings/_repository_storage.html.haml_spec.rb b/spec/views/admin/application_settings/_repository_storage.html.haml_spec.rb index 63236dbb0c4..2915fe1964f 100644 --- a/spec/views/admin/application_settings/_repository_storage.html.haml_spec.rb +++ b/spec/views/admin/application_settings/_repository_storage.html.haml_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe 'admin/application_settings/_repository_storage.html.haml' do +RSpec.describe 'admin/application_settings/_repository_storage.html.haml' do let(:app_settings) { create(:application_setting) } let(:repository_storages_weighted_attributes) { [:repository_storages_weighted_default, :repository_storages_weighted_mepmep, :repository_storages_weighted_foobar]} let(:repository_storages_weighted) do diff --git a/spec/views/admin/application_settings/general.html.haml_spec.rb b/spec/views/admin/application_settings/general.html.haml_spec.rb index d8ca5dd1b49..5343847d755 100644 --- a/spec/views/admin/application_settings/general.html.haml_spec.rb +++ b/spec/views/admin/application_settings/general.html.haml_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe 'admin/application_settings/general.html.haml' do +RSpec.describe 'admin/application_settings/general.html.haml' do let(:app_settings) { build(:application_setting) } let(:user) { create(:admin) } diff --git a/spec/views/admin/application_settings/repository.html.haml_spec.rb b/spec/views/admin/application_settings/repository.html.haml_spec.rb new file mode 100644 index 00000000000..b110bc277ac --- /dev/null +++ b/spec/views/admin/application_settings/repository.html.haml_spec.rb @@ -0,0 +1,46 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe 'admin/application_settings/repository.html.haml' do + let(:app_settings) { build(:application_setting) } + let(:user) { create(:admin) } + + before do + assign(:application_setting, app_settings) + allow(view).to receive(:current_user).and_return(user) + end + + describe 'default initial branch name' do + context 'when the feature flag is disabled' do + before do + stub_feature_flags(global_default_branch_name: false) + end + + it 'does not show the setting section' do + render + + expect(rendered).not_to have_css("#js-default-branch-name") + end + end + + context 'when the feature flag is enabled' do + before do + stub_feature_flags(global_default_branch_name: true) + end + + it 'has the setting section' do + render + + expect(rendered).to have_css("#js-default-branch-name") + end + + it 'renders the correct setting section content' do + render + + expect(rendered).to have_content("Default initial branch name") + expect(rendered).to have_content("Set the default name of the initial branch when creating new repositories through the user interface.") + end + end + end +end diff --git a/spec/views/admin/dashboard/index.html.haml_spec.rb b/spec/views/admin/dashboard/index.html.haml_spec.rb index 93fedde6e96..569a20e8f08 100644 --- a/spec/views/admin/dashboard/index.html.haml_spec.rb +++ b/spec/views/admin/dashboard/index.html.haml_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe 'admin/dashboard/index.html.haml' do +RSpec.describe 'admin/dashboard/index.html.haml' do include Devise::Test::ControllerHelpers before do diff --git a/spec/views/admin/sessions/new.html.haml_spec.rb b/spec/views/admin/sessions/new.html.haml_spec.rb index b52ad0f9505..94870f0bdba 100644 --- a/spec/views/admin/sessions/new.html.haml_spec.rb +++ b/spec/views/admin/sessions/new.html.haml_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe 'admin/sessions/new.html.haml' do +RSpec.describe 'admin/sessions/new.html.haml' do let(:user) { create(:admin) } before do diff --git a/spec/views/admin/sessions/two_factor.html.haml_spec.rb b/spec/views/admin/sessions/two_factor.html.haml_spec.rb index 2c061c7707b..9c5ff9925c1 100644 --- a/spec/views/admin/sessions/two_factor.html.haml_spec.rb +++ b/spec/views/admin/sessions/two_factor.html.haml_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe 'admin/sessions/two_factor.html.haml' do +RSpec.describe 'admin/sessions/two_factor.html.haml' do before do allow(view).to receive(:current_user).and_return(user) end diff --git a/spec/views/admin/users/_user.html.haml_spec.rb b/spec/views/admin/users/_user.html.haml_spec.rb index de5a291a6f8..aed05e4ea9b 100644 --- a/spec/views/admin/users/_user.html.haml_spec.rb +++ b/spec/views/admin/users/_user.html.haml_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe 'admin/users/_user.html.haml' do +RSpec.describe 'admin/users/_user.html.haml' do before do allow(view).to receive(:user).and_return(user) end |