diff options
Diffstat (limited to 'spec/support/shared_contexts')
10 files changed, 39 insertions, 19 deletions
diff --git a/spec/support/shared_contexts/dependency_proxy_shared_context.rb b/spec/support/shared_contexts/dependency_proxy_shared_context.rb new file mode 100644 index 00000000000..02625722a8c --- /dev/null +++ b/spec/support/shared_contexts/dependency_proxy_shared_context.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +RSpec.shared_context 'with a server running the dependency proxy' do + def run_server(handler) + default_server = Capybara.server + + Capybara.server = Capybara.servers[:puma] + server = Capybara::Server.new(handler) + server.boot + server + ensure + Capybara.server = default_server + end +end diff --git a/spec/support/shared_contexts/email_shared_context.rb b/spec/support/shared_contexts/email_shared_context.rb index 8b4c1c1e243..3098fc3dc5e 100644 --- a/spec/support/shared_contexts/email_shared_context.rb +++ b/spec/support/shared_contexts/email_shared_context.rb @@ -191,7 +191,7 @@ RSpec.shared_examples 'note handler shared examples' do |forwardable| context 'when the service desk' do let(:project) { create(:project, :public, service_desk_enabled: true) } - let(:support_bot) { User.support_bot } + let(:support_bot) { Users::Internal.support_bot } let(:noteable) { create(:issue, project: project, author: support_bot, title: 'service desk issue') } let!(:note) { create(:note, project: project, noteable: noteable) } let(:email_raw) { with_quick_actions } diff --git a/spec/support/shared_contexts/features/integrations/group_integrations_shared_context.rb b/spec/support/shared_contexts/features/integrations/group_integrations_shared_context.rb index 5996fcc6593..befc231f04f 100644 --- a/spec/support/shared_contexts/features/integrations/group_integrations_shared_context.rb +++ b/spec/support/shared_contexts/features/integrations/group_integrations_shared_context.rb @@ -22,7 +22,7 @@ RSpec.shared_context 'group integration activation' do visit_group_integrations within('#content-body') do - click_link(name) + click_link(name, match: :first) end end end diff --git a/spec/support/shared_contexts/features/integrations/instance_integrations_shared_context.rb b/spec/support/shared_contexts/features/integrations/instance_integrations_shared_context.rb index 3b02db994a3..c740917cec4 100644 --- a/spec/support/shared_contexts/features/integrations/instance_integrations_shared_context.rb +++ b/spec/support/shared_contexts/features/integrations/instance_integrations_shared_context.rb @@ -18,7 +18,7 @@ RSpec.shared_context 'instance integration activation' do visit_instance_integrations within('#content-body') do - click_link(name) + click_link(name, match: :first) end end end diff --git a/spec/support/shared_contexts/features/integrations/project_integrations_shared_context.rb b/spec/support/shared_contexts/features/integrations/project_integrations_shared_context.rb index a9b9a5246e6..c3da9435e05 100644 --- a/spec/support/shared_contexts/features/integrations/project_integrations_shared_context.rb +++ b/spec/support/shared_contexts/features/integrations/project_integrations_shared_context.rb @@ -4,7 +4,7 @@ RSpec.shared_context 'project integration activation' do include_context 'with integration activation' let_it_be(:project) { create(:project) } - let_it_be(:user) { create(:user) } + let_it_be(:user) { create(:user, :no_super_sidebar) } before do project.add_maintainer(user) @@ -19,7 +19,7 @@ RSpec.shared_context 'project integration activation' do visit_project_integrations within('#content-body') do - click_link(name) + click_link(name, match: :first) end end diff --git a/spec/support/shared_contexts/finders/users_finder_shared_contexts.rb b/spec/support/shared_contexts/finders/users_finder_shared_contexts.rb index ef1c01f72f9..b89b1aabd87 100644 --- a/spec/support/shared_contexts/finders/users_finder_shared_contexts.rb +++ b/spec/support/shared_contexts/finders/users_finder_shared_contexts.rb @@ -8,5 +8,5 @@ RSpec.shared_context 'UsersFinder#execute filter by project context' do let_it_be(:external_user) { create(:user, :external) } let_it_be(:unconfirmed_user) { create(:user, confirmed_at: nil) } let_it_be(:omniauth_user) { create(:omniauth_user, provider: 'twitter', extern_uid: '123456') } - let_it_be(:internal_user) { User.alert_bot.tap { |u| u.confirm } } + let_it_be(:internal_user) { Users::Internal.alert_bot.tap { |u| u.confirm } } end diff --git a/spec/support/shared_contexts/lib/gitlab/database/load_balancing/wal_tracking_shared_context.rb b/spec/support/shared_contexts/lib/gitlab/database/load_balancing/wal_tracking_shared_context.rb index cbbd3754108..46d6a1fbac0 100644 --- a/spec/support/shared_contexts/lib/gitlab/database/load_balancing/wal_tracking_shared_context.rb +++ b/spec/support/shared_contexts/lib/gitlab/database/load_balancing/wal_tracking_shared_context.rb @@ -62,7 +62,13 @@ RSpec.shared_context 'when tracking WAL location reference' do def stub_replica_available!(available) ::Gitlab::Database::LoadBalancing.each_load_balancer do |lb| - allow(lb).to receive(:select_up_to_date_host).with(current_location).and_return(available) + result = if available + ::Gitlab::Database::LoadBalancing::LoadBalancer::ANY_CAUGHT_UP + else + ::Gitlab::Database::LoadBalancing::LoadBalancer::NONE_CAUGHT_UP + end + + allow(lb).to receive(:select_up_to_date_host).with(current_location).and_return(result) end end end diff --git a/spec/support/shared_contexts/navbar_structure_context.rb b/spec/support/shared_contexts/navbar_structure_context.rb index 112b90029b8..a09319b4980 100644 --- a/spec/support/shared_contexts/navbar_structure_context.rb +++ b/spec/support/shared_contexts/navbar_structure_context.rb @@ -82,7 +82,6 @@ RSpec.shared_context 'project navbar structure' do { nav_item: _('Monitor'), nav_sub_items: [ - _('Tracing'), _('Error Tracking'), _('Alerts'), _('Incidents') @@ -165,15 +164,6 @@ RSpec.shared_context 'group navbar structure' do } end - let(:ci_cd_nav_item) do - { - nav_item: _('CI/CD'), - nav_sub_items: [ - s_('Runners|Runners') - ] - } - end - let(:issues_nav_items) do [ _('List'), @@ -207,6 +197,12 @@ RSpec.shared_context 'group navbar structure' do }, (security_and_compliance_nav_item if Gitlab.ee?), { + nav_item: _('CI/CD'), + nav_sub_items: [ + s_('Runners|Runners') + ] + }, + { nav_item: _('Kubernetes'), nav_sub_items: [] }, @@ -231,6 +227,10 @@ RSpec.shared_context 'dashboard navbar structure' do nav_sub_items: [] }, { + nav_item: _('Organizations'), + nav_sub_items: [] + }, + { nav_item: _("Issues"), nav_sub_items: [] }, diff --git a/spec/support/shared_contexts/policies/group_policy_shared_context.rb b/spec/support/shared_contexts/policies/group_policy_shared_context.rb index 07a4cbdb534..70b48322efd 100644 --- a/spec/support/shared_contexts/policies/group_policy_shared_context.rb +++ b/spec/support/shared_contexts/policies/group_policy_shared_context.rb @@ -58,6 +58,7 @@ RSpec.shared_context 'GroupPolicy context' do destroy_upload admin_achievement award_achievement + read_group_runners ] end @@ -73,7 +74,6 @@ RSpec.shared_context 'GroupPolicy context' do create_subgroup read_statistics update_default_branch_protection - read_group_runners register_group_runners read_billing edit_billing diff --git a/spec/support/shared_contexts/requests/api/npm_packages_shared_context.rb b/spec/support/shared_contexts/requests/api/npm_packages_shared_context.rb index 36103b94542..cf5ac849f63 100644 --- a/spec/support/shared_contexts/requests/api/npm_packages_shared_context.rb +++ b/spec/support/shared_contexts/requests/api/npm_packages_shared_context.rb @@ -5,7 +5,7 @@ RSpec.shared_context 'npm api setup' do include HttpBasicAuthHelpers let_it_be(:user, reload: true) { create(:user) } - let_it_be(:group) { create(:group, name: 'test-group') } + let_it_be(:group, reload: true) { create(:group, name: 'test-group') } let_it_be(:namespace) { group } let_it_be(:project, reload: true) { create(:project, :public, namespace: namespace) } let_it_be(:package, reload: true) { create(:npm_package, project: project, name: "@#{group.path}/scoped_package", version: '1.2.3') } |