Commit a9dba1d0 authored by Doug Stull's avatar Doug Stull

Resolve RSpec/EmptyLineAfterLetBlock Exceptions in EE

- standards/style guide enforcement
parent f301e923
...@@ -290,100 +290,6 @@ RSpec/ContextWording: ...@@ -290,100 +290,6 @@ RSpec/ContextWording:
RSpec/EmptyLineAfterLetBlock: RSpec/EmptyLineAfterLetBlock:
Enabled: true Enabled: true
Exclude: Exclude:
- 'ee/spec/controllers/admin/application_settings_controller_spec.rb'
- 'ee/spec/controllers/ee/projects/protected_branches_controller_spec.rb'
- 'ee/spec/controllers/ee/sent_notifications_controller_spec.rb'
- 'ee/spec/controllers/projects/security/network_policies_controller_spec.rb'
- 'ee/spec/features/admin/admin_emails_spec.rb'
- 'ee/spec/features/merge_request/user_creates_merge_request_spec.rb'
- 'ee/spec/features/merge_requests/user_filters_by_approvers_spec.rb'
- 'ee/spec/features/merge_requests/user_resets_approvers_spec.rb'
- 'ee/spec/finders/group_saml_identity_finder_spec.rb'
- 'ee/spec/finders/merge_requests/by_approvers_finder_spec.rb'
- 'ee/spec/finders/security/vulnerability_findings_finder_spec.rb'
- 'ee/spec/helpers/application_helper_spec.rb'
- 'ee/spec/helpers/ee/namespaces_helper_spec.rb'
- 'ee/spec/helpers/push_rules_helper_spec.rb'
- 'ee/spec/helpers/vulnerabilities_helper_spec.rb'
- 'ee/spec/lib/audit/details_spec.rb'
- 'ee/spec/lib/container_registry/client_spec.rb'
- 'ee/spec/lib/ee/api/entities/analytics/code_review/merge_request_spec.rb'
- 'ee/spec/lib/ee/gitlab/auth/ldap/access_levels_spec.rb'
- 'ee/spec/lib/ee/gitlab/auth/ldap/group_spec.rb'
- 'ee/spec/lib/ee/gitlab/auth/ldap/sync/group_spec.rb'
- 'ee/spec/lib/ee/gitlab/background_migration/move_epic_issues_after_epics_spec.rb'
- 'ee/spec/lib/ee/gitlab/ci/config_spec.rb'
- 'ee/spec/lib/gitlab/auth/ldap/user_spec.rb'
- 'ee/spec/lib/gitlab/auth/smartcard/ldap_certificate_spec.rb'
- 'ee/spec/lib/gitlab/auth_spec.rb'
- 'ee/spec/lib/gitlab/background_migration/user_mentions/create_resource_user_mention_spec.rb'
- 'ee/spec/lib/gitlab/ci/reports/security/report_spec.rb'
- 'ee/spec/lib/gitlab/contribution_analytics/data_collector_spec.rb'
- 'ee/spec/lib/gitlab/elastic/client_spec.rb'
- 'ee/spec/lib/gitlab/elastic/search_results_spec.rb'
- 'ee/spec/lib/gitlab/expiring_subscription_message_spec.rb'
- 'ee/spec/lib/gitlab/graphql/aggregations/epics/lazy_epic_aggregate_spec.rb'
- 'ee/spec/lib/gitlab/insights/finders/issuable_finder_spec.rb'
- 'ee/spec/lib/gitlab/insights/reducers/count_per_label_reducer_spec.rb'
- 'ee/spec/lib/gitlab/insights/reducers/count_per_period_reducer_spec.rb'
- 'ee/spec/lib/gitlab/insights/reducers/label_count_per_period_reducer_spec.rb'
- 'ee/spec/lib/gitlab/prometheus/queries/packet_flow_metrics_query_spec.rb'
- 'ee/spec/lib/gitlab/prometheus/queries/packet_flow_query_spec.rb'
- 'ee/spec/lib/gitlab/subscription_portal/client_spec.rb'
- 'ee/spec/lib/pseudonymizer/uploader_spec.rb'
- 'ee/spec/migrations/set_report_type_for_vulnerabilities_spec.rb'
- 'ee/spec/migrations/set_resolved_state_on_vulnerabilities_spec.rb'
- 'ee/spec/models/burndown_spec.rb'
- 'ee/spec/models/ci/build_spec.rb'
- 'ee/spec/models/elasticsearch_indexed_namespace_spec.rb'
- 'ee/spec/models/elasticsearch_indexed_project_spec.rb'
- 'ee/spec/models/group_member_spec.rb'
- 'ee/spec/models/operations/feature_flag_spec.rb'
- 'ee/spec/models/vulnerability_spec.rb'
- 'ee/spec/policies/project_policy_spec.rb'
- 'ee/spec/requests/api/epics_spec.rb'
- 'ee/spec/requests/api/feature_flags_spec.rb'
- 'ee/spec/requests/api/geo_spec.rb'
- 'ee/spec/requests/api/graphql/current_user/todos_query_spec.rb'
- 'ee/spec/requests/api/graphql/geo/geo_node_spec.rb'
- 'ee/spec/requests/api/graphql/group/epic/epic_aggregate_query_spec.rb'
- 'ee/spec/requests/api/helpers_spec.rb'
- 'ee/spec/requests/api/internal/base_spec.rb'
- 'ee/spec/requests/api/license_spec.rb'
- 'ee/spec/requests/api/merge_request_approval_rules_spec.rb'
- 'ee/spec/requests/api/projects_spec.rb'
- 'ee/spec/requests/api/settings_spec.rb'
- 'ee/spec/requests/api/v3/github_spec.rb'
- 'ee/spec/requests/lfs_http_spec.rb'
- 'ee/spec/requests/projects/mirrors_controller_spec.rb'
- 'ee/spec/requests/smartcard_controller_spec.rb'
- 'ee/spec/serializers/user_analytics_entity_spec.rb'
- 'ee/spec/services/approval_rules/params_filtering_service_spec.rb'
- 'ee/spec/services/dashboard/operations/list_service_spec.rb'
- 'ee/spec/services/ee/audit_events/bulk_insert_service_spec.rb'
- 'ee/spec/services/ee/issues/create_from_vulnerability_data_service_spec.rb'
- 'ee/spec/services/ee/merge_requests/create_from_vulnerability_data_service_spec.rb'
- 'ee/spec/services/ee/merge_requests/refresh_service_spec.rb'
- 'ee/spec/services/ee/preview_markdown_service_spec.rb'
- 'ee/spec/services/elastic/indexing_control_service_spec.rb'
- 'ee/spec/services/epics/update_dates_service_spec.rb'
- 'ee/spec/services/epics/update_service_spec.rb'
- 'ee/spec/services/geo/file_registry_removal_service_spec.rb'
- 'ee/spec/services/group_saml/saml_provider/update_service_spec.rb'
- 'ee/spec/services/groups/create_service_spec.rb'
- 'ee/spec/services/groups/destroy_service_spec.rb'
- 'ee/spec/services/groups/update_service_spec.rb'
- 'ee/spec/services/projects/create_service_spec.rb'
- 'ee/spec/services/projects/destroy_service_spec.rb'
- 'ee/spec/services/projects/group_links/create_service_spec.rb'
- 'ee/spec/services/projects/group_links/destroy_service_spec.rb'
- 'ee/spec/services/projects/prometheus/alerts/notify_service_spec.rb'
- 'ee/spec/services/projects/transfer_service_spec.rb'
- 'ee/spec/services/projects/update_service_spec.rb'
- 'ee/spec/services/search/snippet_service_spec.rb'
- 'ee/spec/services/todo_service_spec.rb'
- 'ee/spec/support/shared_examples/requests/api/graphql/geo/registries_shared_examples.rb'
- 'ee/spec/workers/concerns/elastic/indexing_control_spec.rb'
- 'qa/qa/specs/features/api/3_create/repository/changing_repository_storage_spec.rb' - 'qa/qa/specs/features/api/3_create/repository/changing_repository_storage_spec.rb'
- 'qa/qa/specs/features/browser_ui/3_create/gitaly/high_availability_spec.rb' - 'qa/qa/specs/features/browser_ui/3_create/gitaly/high_availability_spec.rb'
- 'qa/qa/specs/features/browser_ui/3_create/repository/move_project_create_fork_spec.rb' - 'qa/qa/specs/features/browser_ui/3_create/repository/move_project_create_fork_spec.rb'
......
...@@ -92,6 +92,7 @@ RSpec.describe Admin::ApplicationSettingsController do ...@@ -92,6 +92,7 @@ RSpec.describe Admin::ApplicationSettingsController do
mirror_capacity_threshold: 2 mirror_capacity_threshold: 2
} }
end end
let(:feature) { :repository_mirrors } let(:feature) { :repository_mirrors }
it_behaves_like 'settings for licensed features' it_behaves_like 'settings for licensed features'
...@@ -136,6 +137,7 @@ RSpec.describe Admin::ApplicationSettingsController do ...@@ -136,6 +137,7 @@ RSpec.describe Admin::ApplicationSettingsController do
maintenance_mode_message: 'GitLab is in maintenance' maintenance_mode_message: 'GitLab is in maintenance'
} }
end end
let(:feature) { :geo } let(:feature) { :geo }
it_behaves_like 'settings for licensed features' it_behaves_like 'settings for licensed features'
......
...@@ -27,6 +27,7 @@ RSpec.describe Projects::ProtectedBranchesController do ...@@ -27,6 +27,7 @@ RSpec.describe Projects::ProtectedBranchesController do
{ merge_access_levels_attributes: maintainer_access_level, { merge_access_levels_attributes: maintainer_access_level,
push_access_levels_attributes: maintainer_access_level } push_access_levels_attributes: maintainer_access_level }
end end
let(:create_params) do let(:create_params) do
attributes_for(:protected_branch).merge(access_level_params) attributes_for(:protected_branch).merge(access_level_params)
end end
......
...@@ -11,6 +11,7 @@ RSpec.describe SentNotificationsController do ...@@ -11,6 +11,7 @@ RSpec.describe SentNotificationsController do
epic.subscriptions.create!(user: user, project: nil, subscribed: true) epic.subscriptions.create!(user: user, project: nil, subscribed: true)
end end
end end
let(:sent_notification) { create(:sent_notification, project: nil, noteable: epic, recipient: user) } let(:sent_notification) { create(:sent_notification, project: nil, noteable: epic, recipient: user) }
before do before do
......
...@@ -188,6 +188,7 @@ RSpec.describe Projects::Security::NetworkPoliciesController do ...@@ -188,6 +188,7 @@ RSpec.describe Projects::Security::NetworkPoliciesController do
ingress: [{ from: [{ namespaceSelector: { matchLabels: { project: 'myproject' } } }] }] ingress: [{ from: [{ namespaceSelector: { matchLabels: { project: 'myproject' } } }] }]
) )
end end
let(:manifest) do let(:manifest) do
<<~POLICY <<~POLICY
apiVersion: networking.k8s.io/v1 apiVersion: networking.k8s.io/v1
...@@ -251,6 +252,7 @@ RSpec.describe Projects::Security::NetworkPoliciesController do ...@@ -251,6 +252,7 @@ RSpec.describe Projects::Security::NetworkPoliciesController do
ingress: [{ from: [{ namespaceSelector: { matchLabels: { project: 'myproject' } } }] }] ingress: [{ from: [{ namespaceSelector: { matchLabels: { project: 'myproject' } } }] }]
) )
end end
let(:manifest) do let(:manifest) do
<<~POLICY <<~POLICY
apiVersion: networking.k8s.io/v1 apiVersion: networking.k8s.io/v1
......
...@@ -26,6 +26,7 @@ RSpec.describe 'Admin::Emails', :clean_gitlab_redis_shared_state do ...@@ -26,6 +26,7 @@ RSpec.describe 'Admin::Emails', :clean_gitlab_redis_shared_state do
'An email notification was recently sent from the admin panel. '\ 'An email notification was recently sent from the admin panel. '\
'Please wait 10 minutes before attempting to send another message.' 'Please wait 10 minutes before attempting to send another message.'
end end
let(:submit_button) { find('input[type="submit"]') } let(:submit_button) { find('input[type="submit"]') }
before do before do
......
...@@ -9,6 +9,7 @@ RSpec.describe "User creates a merge request", :js do ...@@ -9,6 +9,7 @@ RSpec.describe "User creates a merge request", :js do
let(:project) do let(:project) do
create(:project, :repository, merge_requests_template: template_text) create(:project, :repository, merge_requests_template: template_text)
end end
let(:template_text) { "This merge request should contain the following." } let(:template_text) { "This merge request should contain the following." }
let(:title) { "Some feature" } let(:title) { "Some feature" }
let(:user) { create(:user) } let(:user) { create(:user) }
......
...@@ -17,6 +17,7 @@ RSpec.describe 'Merge Requests > User filters', :js do ...@@ -17,6 +17,7 @@ RSpec.describe 'Merge Requests > User filters', :js do
let!(:merge_request_with_two_approvers) do let!(:merge_request_with_two_approvers) do
create(:merge_request, title: 'Bugfix2', approval_users: [user, first_user], source_project: project, source_branch: 'bugfix2') create(:merge_request, title: 'Bugfix2', approval_users: [user, first_user], source_project: project, source_branch: 'bugfix2')
end end
let!(:merge_request) { create(:merge_request, title: 'Bugfix3', source_project: project, source_branch: 'bugfix3') } let!(:merge_request) { create(:merge_request, title: 'Bugfix3', source_project: project, source_branch: 'bugfix3') }
let!(:merge_request_with_group_approver) do let!(:merge_request_with_group_approver) do
group = create(:group) group = create(:group)
......
...@@ -12,6 +12,7 @@ RSpec.describe 'Merge Requests > User resets approvers', :js do ...@@ -12,6 +12,7 @@ RSpec.describe 'Merge Requests > User resets approvers', :js do
let(:merge_request) do let(:merge_request) do
create(:merge_request, approval_users: [first_user], title: 'Bugfix1', source_project: project) create(:merge_request, approval_users: [first_user], title: 'Bugfix1', source_project: project)
end end
let!(:rule) { create(:approval_project_rule, project: project, users: project_approvers, approvals_required: 1 )} let!(:rule) { create(:approval_project_rule, project: project, users: project_approvers, approvals_required: 1 )}
before do before do
......
...@@ -30,6 +30,7 @@ RSpec.describe GroupSamlIdentityFinder do ...@@ -30,6 +30,7 @@ RSpec.describe GroupSamlIdentityFinder do
let!(:group_managed_identity) do let!(:group_managed_identity) do
create(:group_saml_identity, saml_provider: saml_provider, user: create(:user, managing_group: group)) create(:group_saml_identity, saml_provider: saml_provider, user: create(:user, managing_group: group))
end end
let!(:different_group_managed_identity) do let!(:different_group_managed_identity) do
create(:group_saml_identity, saml_provider: saml_provider, user: create(:user, :group_managed)) create(:group_saml_identity, saml_provider: saml_provider, user: create(:user, :group_managed))
end end
......
...@@ -32,6 +32,7 @@ RSpec.describe MergeRequests::ByApproversFinder do ...@@ -32,6 +32,7 @@ RSpec.describe MergeRequests::ByApproversFinder do
merge_request.approval_rules << rule merge_request.approval_rules << rule
end end
end end
let!(:merge_request_with_project_group_approver) do let!(:merge_request_with_project_group_approver) do
rule = create(:approval_project_rule, groups: [group]) rule = create(:approval_project_rule, groups: [group])
create(:merge_request, source_project: create(:project, approval_rules: [rule])) create(:merge_request, source_project: create(:project, approval_rules: [rule]))
......
...@@ -140,6 +140,7 @@ RSpec.describe Security::VulnerabilityFindingsFinder do ...@@ -140,6 +140,7 @@ RSpec.describe Security::VulnerabilityFindingsFinder do
project: project1, project: project1,
project_fingerprint: finding1.project_fingerprint) project_fingerprint: finding1.project_fingerprint)
end end
let!(:issue) do let!(:issue) do
create(:vulnerability_feedback, :sast, :issue, create(:vulnerability_feedback, :sast, :issue,
pipeline: pipeline1, pipeline: pipeline1,
......
...@@ -162,6 +162,7 @@ RSpec.describe ApplicationHelper do ...@@ -162,6 +162,7 @@ RSpec.describe ApplicationHelper do
let(:expected_partial_path) do let(:expected_partial_path) do
"app/views/#{File.dirname(partial)}/_#{File.basename(partial)}.html.haml" "app/views/#{File.dirname(partial)}/_#{File.basename(partial)}.html.haml"
end end
let(:expected_view_path) do let(:expected_view_path) do
"app/views/#{File.dirname(view)}/#{File.basename(view)}.html.haml" "app/views/#{File.dirname(view)}/#{File.basename(view)}.html.haml"
end end
......
...@@ -9,6 +9,7 @@ RSpec.describe EE::NamespacesHelper do ...@@ -9,6 +9,7 @@ RSpec.describe EE::NamespacesHelper do
:private, :private,
project_creation_level: admin_project_creation_level) project_creation_level: admin_project_creation_level)
end end
let!(:user) { create(:user) } let!(:user) { create(:user) }
let!(:user_project_creation_level) { nil } let!(:user_project_creation_level) { nil }
let!(:user_group) do let!(:user_group) do
......
...@@ -17,6 +17,7 @@ RSpec.describe PushRulesHelper do ...@@ -17,6 +17,7 @@ RSpec.describe PushRulesHelper do
requires_admin_contact: /Contact an admin to change this setting/ requires_admin_contact: /Contact an admin to change this setting/
} }
end end
let(:users) do let(:users) do
{ {
admin: admin, admin: admin,
......
...@@ -204,6 +204,7 @@ RSpec.describe Audit::Details do ...@@ -204,6 +204,7 @@ RSpec.describe Audit::Details do
ip_address: '127.0.0.1' ip_address: '127.0.0.1'
} }
end end
let(:message) { 'Failed to login with GOOGLE authentication' } let(:message) { 'Failed to login with GOOGLE authentication' }
it 'shows the correct failed login meessage' do it 'shows the correct failed login meessage' do
......
...@@ -15,6 +15,7 @@ RSpec.describe ContainerRegistry::Client do ...@@ -15,6 +15,7 @@ RSpec.describe ContainerRegistry::Client do
'User-Agent' => "GitLab/#{Gitlab::VERSION}" 'User-Agent' => "GitLab/#{Gitlab::VERSION}"
} }
end end
let(:headers_with_accept_types) do let(:headers_with_accept_types) do
{ {
'Accept' => 'application/vnd.docker.distribution.manifest.v2+json, application/vnd.oci.image.manifest.v1+json', 'Accept' => 'application/vnd.docker.distribution.manifest.v2+json, application/vnd.oci.image.manifest.v1+json',
......
...@@ -12,6 +12,7 @@ RSpec.describe EE::API::Entities::Analytics::CodeReview::MergeRequest do ...@@ -12,6 +12,7 @@ RSpec.describe EE::API::Entities::Analytics::CodeReview::MergeRequest do
metrics_data: { first_comment_at: 1.day.ago, merged_at: 1.hour.ago } metrics_data: { first_comment_at: 1.day.ago, merged_at: 1.hour.ago }
) )
end end
let(:project) { create :project, :repository } let(:project) { create :project, :repository }
let(:milestone) { create(:milestone, project: project) } let(:milestone) { create(:milestone, project: project) }
let!(:note) { create(:note_on_merge_request, project: project, noteable: merge_request) } let!(:note) { create(:note_on_merge_request, project: project, noteable: merge_request) }
......
...@@ -35,6 +35,7 @@ RSpec.describe EE::Gitlab::Auth::Ldap::AccessLevels do ...@@ -35,6 +35,7 @@ RSpec.describe EE::Gitlab::Auth::Ldap::AccessLevels do
uid=jamesdoe,ou=users,dc=example,dc=com uid=jamesdoe,ou=users,dc=example,dc=com
} }
end end
let(:master_dns) do let(:master_dns) do
%w{ %w{
uid=johndoe,ou=users,dc=example,dc=com uid=johndoe,ou=users,dc=example,dc=com
......
...@@ -47,6 +47,7 @@ RSpec.describe EE::Gitlab::Auth::Ldap::Group do ...@@ -47,6 +47,7 @@ RSpec.describe EE::Gitlab::Auth::Ldap::Group do
member_attr: 'member' member_attr: 'member'
) )
end end
let(:group2_entry) do let(:group2_entry) do
ldap_group_entry( ldap_group_entry(
[user_dn('user3'), user_dn('user4')], [user_dn('user3'), user_dn('user4')],
...@@ -56,6 +57,7 @@ RSpec.describe EE::Gitlab::Auth::Ldap::Group do ...@@ -56,6 +57,7 @@ RSpec.describe EE::Gitlab::Auth::Ldap::Group do
member_of: group1_entry.dn member_of: group1_entry.dn
) )
end end
let(:group) { described_class.new(group1_entry, adapter) } let(:group) { described_class.new(group1_entry, adapter) }
it 'resolves the correct member_dns when there are nested groups' do it 'resolves the correct member_dns when there are nested groups' do
......
...@@ -99,6 +99,7 @@ RSpec.describe EE::Gitlab::Auth::Ldap::Sync::Group do ...@@ -99,6 +99,7 @@ RSpec.describe EE::Gitlab::Auth::Ldap::Sync::Group do
cn: 'ldap_group1', cn: 'ldap_group1',
group_access: ::Gitlab::Access::DEVELOPER) group_access: ::Gitlab::Access::DEVELOPER)
end end
let(:ldap_group1) { ldap_group_entry(user_dn(user.username)) } let(:ldap_group1) { ldap_group_entry(user_dn(user.username)) }
include_examples :group_state_machine include_examples :group_state_machine
...@@ -114,6 +115,7 @@ RSpec.describe EE::Gitlab::Auth::Ldap::Sync::Group do ...@@ -114,6 +115,7 @@ RSpec.describe EE::Gitlab::Auth::Ldap::Sync::Group do
cn: 'ldap_group1', cn: 'ldap_group1',
group_access: ::Gitlab::Access::DEVELOPER) group_access: ::Gitlab::Access::DEVELOPER)
end end
let(:ldap_group1) { ldap_group_entry(user_dn(user.username)) } let(:ldap_group1) { ldap_group_entry(user_dn(user.username)) }
include_examples :group_state_machine include_examples :group_state_machine
...@@ -175,6 +177,7 @@ RSpec.describe EE::Gitlab::Auth::Ldap::Sync::Group do ...@@ -175,6 +177,7 @@ RSpec.describe EE::Gitlab::Auth::Ldap::Sync::Group do
cn: 'ldap_group1', cn: 'ldap_group1',
group_access: ::Gitlab::Access::DEVELOPER) group_access: ::Gitlab::Access::DEVELOPER)
end end
let(:sync_group) { described_class.new(group, proxy(adapter)) } let(:sync_group) { described_class.new(group, proxy(adapter)) }
context 'with all functionality against one LDAP group type' do context 'with all functionality against one LDAP group type' do
...@@ -532,6 +535,7 @@ RSpec.describe EE::Gitlab::Auth::Ldap::Sync::Group do ...@@ -532,6 +535,7 @@ RSpec.describe EE::Gitlab::Auth::Ldap::Sync::Group do
member_attr: 'memberUid' member_attr: 'memberUid'
) )
end end
let(:ldap_user) do let(:ldap_user) do
ldap_user_entry(user.username) ldap_user_entry(user.username)
end end
...@@ -584,6 +588,7 @@ RSpec.describe EE::Gitlab::Auth::Ldap::Sync::Group do ...@@ -584,6 +588,7 @@ RSpec.describe EE::Gitlab::Auth::Ldap::Sync::Group do
create(:group_with_ldap_group_filter_link, create(:group_with_ldap_group_filter_link,
group_access: ::Gitlab::Access::DEVELOPER) group_access: ::Gitlab::Access::DEVELOPER)
end end
let(:sync_group) { described_class.new(group, proxy(adapter)) } let(:sync_group) { described_class.new(group, proxy(adapter)) }
before do before do
......
...@@ -21,6 +21,7 @@ RSpec.describe Gitlab::BackgroundMigration::MoveEpicIssuesAfterEpics, schema: 20 ...@@ -21,6 +21,7 @@ RSpec.describe Gitlab::BackgroundMigration::MoveEpicIssuesAfterEpics, schema: 20
author_id: user.id author_id: user.id
} }
end end
let(:issue_params) do let(:issue_params) do
{ {
title: 'Issue', title: 'Issue',
......
...@@ -13,6 +13,7 @@ RSpec.describe Gitlab::Ci::Config do ...@@ -13,6 +13,7 @@ RSpec.describe Gitlab::Ci::Config do
- echo 'test' - echo 'test'
EOS EOS
end end
let(:template_yml) do let(:template_yml) do
<<-EOS <<-EOS
sample_job: sample_job:
......
...@@ -14,9 +14,11 @@ RSpec.describe Gitlab::Auth::Ldap::User do ...@@ -14,9 +14,11 @@ RSpec.describe Gitlab::Auth::Ldap::User do
nickname: 'john' nickname: 'john'
} }
end end
let(:auth_hash) do let(:auth_hash) do
OmniAuth::AuthHash.new(uid: 'uid=john,ou=people,dc=example,dc=com', provider: 'ldapmain', info: info) OmniAuth::AuthHash.new(uid: 'uid=john,ou=people,dc=example,dc=com', provider: 'ldapmain', info: info)
end end
let(:group_cn) { 'foo' } let(:group_cn) { 'foo' }
let(:group_member_dns) { [auth_hash.uid] } let(:group_member_dns) { [auth_hash.uid] }
let(:external_groups) { [] } let(:external_groups) { [] }
......
...@@ -13,6 +13,7 @@ RSpec.describe Gitlab::Auth::Smartcard::LdapCertificate do ...@@ -13,6 +13,7 @@ RSpec.describe Gitlab::Auth::Smartcard::LdapCertificate do
{ issuer: issuer, { issuer: issuer,
serial: '42' } ) serial: '42' } )
end end
let(:ldap_provider) { 'ldapmain' } let(:ldap_provider) { 'ldapmain' }
let(:ldap_connection) { instance_double(::Net::LDAP) } let(:ldap_connection) { instance_double(::Net::LDAP) }
let(:ldap_person_name) { 'John Doe' } let(:ldap_person_name) { 'John Doe' }
......
...@@ -10,6 +10,7 @@ RSpec.describe Gitlab::Auth do ...@@ -10,6 +10,7 @@ RSpec.describe Gitlab::Auth do
password: password, password: password,
password_confirmation: password) password_confirmation: password)
end end
let(:username) { 'John' } # username isn't lowercase, test this let(:username) { 'John' } # username isn't lowercase, test this
let(:password) { 'my-secret' } let(:password) { 'my-secret' }
......
...@@ -54,10 +54,12 @@ RSpec.describe Gitlab::BackgroundMigration::UserMentions::CreateResourceUserMent ...@@ -54,10 +54,12 @@ RSpec.describe Gitlab::BackgroundMigration::UserMentions::CreateResourceUserMent
epics.create!(iid: 1, group_id: group.id, author_id: author.id, title: "epic title @#{author.username}", epics.create!(iid: 1, group_id: group.id, author_id: author.id, title: "epic title @#{author.username}",
title_html: "epic title @#{author.username}", description: description_mentions) title_html: "epic title @#{author.username}", description: description_mentions)
end end
let!(:epic2) do let!(:epic2) do
epics.create!(iid: 2, group_id: group.id, author_id: author.id, title: "epic title}", epics.create!(iid: 2, group_id: group.id, author_id: author.id, title: "epic title}",
title_html: "epic title", description: 'simple description') title_html: "epic title", description: 'simple description')
end end
let!(:epic3) do let!(:epic3) do
epics.create!(iid: 3, group_id: group.id, author_id: author.id, title: "epic title}", epics.create!(iid: 3, group_id: group.id, author_id: author.id, title: "epic title}",
title_html: "epic title", description: 'description with an email@example.com and some other @ char here.') title_html: "epic title", description: 'description with an email@example.com and some other @ char here.')
......
...@@ -82,6 +82,7 @@ RSpec.describe Gitlab::Ci::Reports::Security::Report do ...@@ -82,6 +82,7 @@ RSpec.describe Gitlab::Ci::Reports::Security::Report do
identifiers: [create(:ci_reports_security_identifier)] identifiers: [create(:ci_reports_security_identifier)]
) )
end end
let(:other_report) do let(:other_report) do
create( create(
:ci_reports_security_report, :ci_reports_security_report,
......
...@@ -44,6 +44,7 @@ RSpec.describe Gitlab::ContributionAnalytics::DataCollector do ...@@ -44,6 +44,7 @@ RSpec.describe Gitlab::ContributionAnalytics::DataCollector do
[11, Issue.name, Event.actions[:closed]] => 11 [11, Issue.name, Event.actions[:closed]] => 11
} }
end end
let(:data_collector) { described_class.new(group: Group.new) } let(:data_collector) { described_class.new(group: Group.new) }
before do before do
......
...@@ -635,6 +635,7 @@ RSpec.describe Gitlab::Elastic::SearchResults, :elastic, :sidekiq_might_not_need ...@@ -635,6 +635,7 @@ RSpec.describe Gitlab::Elastic::SearchResults, :elastic, :sidekiq_might_not_need
FILE FILE
end end
let(:file_name) { 'elastic_specialchars_test.md' } let(:file_name) { 'elastic_specialchars_test.md' }
before do before do
......
...@@ -18,6 +18,7 @@ RSpec.describe Gitlab::ExpiringSubscriptionMessage do ...@@ -18,6 +18,7 @@ RSpec.describe Gitlab::ExpiringSubscriptionMessage do
namespace: namespace namespace: namespace
).message ).message
end end
let(:grace_period_effective_from) { expired_date - 35.days } let(:grace_period_effective_from) { expired_date - 35.days }
let(:today) { Time.utc(2020, 3, 7, 10) } let(:today) { Time.utc(2020, 3, 7, 10) }
let(:expired_date) { Time.utc(2020, 3, 9, 10).to_date } let(:expired_date) { Time.utc(2020, 3, 9, 10).to_date }
......
...@@ -8,6 +8,7 @@ RSpec.describe Gitlab::Graphql::Aggregations::Epics::LazyEpicAggregate do ...@@ -8,6 +8,7 @@ RSpec.describe Gitlab::Graphql::Aggregations::Epics::LazyEpicAggregate do
let(:query_ctx) do let(:query_ctx) do
{} {}
end end
let(:epic_id) { 37 } let(:epic_id) { 37 }
let(:epic_iid) { 18 } let(:epic_iid) { 18 }
let(:child_epic_id) { 38 } let(:child_epic_id) { 38 }
...@@ -44,6 +45,7 @@ RSpec.describe Gitlab::Graphql::Aggregations::Epics::LazyEpicAggregate do ...@@ -44,6 +45,7 @@ RSpec.describe Gitlab::Graphql::Aggregations::Epics::LazyEpicAggregate do
let(:single_record) do let(:single_record) do
{ iid: 6, issues_count: 4, issues_weight_sum: 9, parent_id: nil, issues_state_id: OPENED_ISSUE_STATE, epic_state_id: OPENED_EPIC_STATE } { iid: 6, issues_count: 4, issues_weight_sum: 9, parent_id: nil, issues_state_id: OPENED_ISSUE_STATE, epic_state_id: OPENED_EPIC_STATE }
end end
let(:epic_info_node) { Gitlab::Graphql::Aggregations::Epics::EpicNode.new(epic_id, [single_record] ) } let(:epic_info_node) { Gitlab::Graphql::Aggregations::Epics::EpicNode.new(epic_id, [single_record] ) }
subject { described_class.new(query_ctx, epic_id, COUNT) } subject { described_class.new(query_ctx, epic_id, COUNT) }
...@@ -70,6 +72,7 @@ RSpec.describe Gitlab::Graphql::Aggregations::Epics::LazyEpicAggregate do ...@@ -70,6 +72,7 @@ RSpec.describe Gitlab::Graphql::Aggregations::Epics::LazyEpicAggregate do
let(:fake_state) do let(:fake_state) do
{ pending_ids: Set.new([epic_id, child_epic_id]), tree: {} } { pending_ids: Set.new([epic_id, child_epic_id]), tree: {} }
end end
let(:fake_data) do let(:fake_data) do
{ {
epic_id => [{ epic_state_id: OPENED_EPIC_STATE, issues_count: 2, issues_weight_sum: 5, parent_id: nil, issues_state_id: OPENED_ISSUE_STATE }], epic_id => [{ epic_state_id: OPENED_EPIC_STATE, issues_count: 2, issues_weight_sum: 5, parent_id: nil, issues_state_id: OPENED_ISSUE_STATE }],
......
...@@ -132,6 +132,7 @@ RSpec.describe Gitlab::Insights::Finders::IssuableFinder do ...@@ -132,6 +132,7 @@ RSpec.describe Gitlab::Insights::Finders::IssuableFinder do
filter_labels: [label_bug.title], filter_labels: [label_bug.title],
collection_labels: [label_manage.title, label_plan.title, label_create.title]) collection_labels: [label_manage.title, label_plan.title, label_create.title])
end end
let(:projects) { {} } let(:projects) { {} }
subject { find(entity, query: query, projects: projects) } subject { find(entity, query: query, projects: projects) }
......
...@@ -23,6 +23,7 @@ RSpec.describe Gitlab::Insights::Reducers::CountPerLabelReducer do ...@@ -23,6 +23,7 @@ RSpec.describe Gitlab::Insights::Reducers::CountPerLabelReducer do
period_limit: 5 period_limit: 5
} }
end end
let(:issuable_relation) { find_issuables(project, query) } let(:issuable_relation) { find_issuables(project, query) }
subject { reduce(issuable_relation, query[:collection_labels]) } subject { reduce(issuable_relation, query[:collection_labels]) }
......
...@@ -38,6 +38,7 @@ RSpec.describe Gitlab::Insights::Reducers::CountPerPeriodReducer do ...@@ -38,6 +38,7 @@ RSpec.describe Gitlab::Insights::Reducers::CountPerPeriodReducer do
period_limit: 5 period_limit: 5
} }
end end
let(:expected) do let(:expected) do
{ {
'January 2019' => 0, 'January 2019' => 0,
......
...@@ -23,6 +23,7 @@ RSpec.describe Gitlab::Insights::Reducers::LabelCountPerPeriodReducer do ...@@ -23,6 +23,7 @@ RSpec.describe Gitlab::Insights::Reducers::LabelCountPerPeriodReducer do
period_limit: 5 period_limit: 5
} }
end end
let(:issuable_relation) { find_issuables(project, query) } let(:issuable_relation) { find_issuables(project, query) }
subject { reduce(issuable_relation, query[:group_by], query[:collection_labels]) } subject { reduce(issuable_relation, query[:group_by], query[:collection_labels]) }
......
...@@ -10,6 +10,7 @@ RSpec.describe Gitlab::Prometheus::Queries::PacketFlowMetricsQuery do ...@@ -10,6 +10,7 @@ RSpec.describe Gitlab::Prometheus::Queries::PacketFlowMetricsQuery do
{ "metric" => { "verdict" => "DROPPED" }, "value" => [1582231596.64, "5.002730665588791"] } { "metric" => { "verdict" => "DROPPED" }, "value" => [1582231596.64, "5.002730665588791"] }
] ]
end end
let(:client) { double('prometheus_client', query: query_response) } let(:client) { double('prometheus_client', query: query_response) }
subject { described_class.new(client) } subject { described_class.new(client) }
......
...@@ -17,12 +17,14 @@ RSpec.describe Gitlab::Prometheus::Queries::PacketFlowQuery do ...@@ -17,12 +17,14 @@ RSpec.describe Gitlab::Prometheus::Queries::PacketFlowQuery do
{ "metric" => { "verdict" => "DROPPED" }, "values" => [[1582231596.64, "5.002730665588791"]] } { "metric" => { "verdict" => "DROPPED" }, "values" => [[1582231596.64, "5.002730665588791"]] }
] ]
end end
let(:query_response) do let(:query_response) do
[ [
{ "metric" => { "verdict" => "FORWARDED" }, "value" => [1582231596.64, "73772.43143284984"] }, { "metric" => { "verdict" => "FORWARDED" }, "value" => [1582231596.64, "73772.43143284984"] },
{ "metric" => { "verdict" => "DROPPED" }, "value" => [1582231596.64, "5.002730665588791"] } { "metric" => { "verdict" => "DROPPED" }, "value" => [1582231596.64, "5.002730665588791"] }
] ]
end end
let(:result) { subject.query(namespace) } let(:result) { subject.query(namespace) }
it 'returns ops_rate metric' do it 'returns ops_rate metric' do
......
...@@ -7,6 +7,7 @@ RSpec.describe Gitlab::SubscriptionPortal::Client do ...@@ -7,6 +7,7 @@ RSpec.describe Gitlab::SubscriptionPortal::Client do
let(:httparty_response) do let(:httparty_response) do
double(code: http_response.code, response: http_response, body: {}, parsed_response: {}) double(code: http_response.code, response: http_response, body: {}, parsed_response: {})
end end
let(:http_method) { :post } let(:http_method) { :post }
shared_examples 'when response is successful' do shared_examples 'when response is successful' do
......
...@@ -9,6 +9,7 @@ RSpec.describe Pseudonymizer::Uploader do ...@@ -9,6 +9,7 @@ RSpec.describe Pseudonymizer::Uploader do
config: YAML.load_file(Gitlab.config.pseudonymizer.manifest) config: YAML.load_file(Gitlab.config.pseudonymizer.manifest)
) )
end end
let(:remote_directory) { subject.send(:remote_directory) } let(:remote_directory) { subject.send(:remote_directory) }
subject { described_class.new(options) } subject { described_class.new(options) }
......
...@@ -7,6 +7,7 @@ RSpec.describe SetReportTypeForVulnerabilities do ...@@ -7,6 +7,7 @@ RSpec.describe SetReportTypeForVulnerabilities do
let(:confidence_levels) do let(:confidence_levels) do
{ undefined: 0, ignore: 1, unknown: 2, experimental: 3, low: 4, medium: 5, high: 6, confirmed: 7 } { undefined: 0, ignore: 1, unknown: 2, experimental: 3, low: 4, medium: 5, high: 6, confirmed: 7 }
end end
let(:severity_levels) { { undefined: 0, info: 1, unknown: 2, low: 4, medium: 5, high: 6, critical: 7 } } let(:severity_levels) { { undefined: 0, info: 1, unknown: 2, low: 4, medium: 5, high: 6, critical: 7 } }
let(:report_types) { { sast: 0, dependency_scanning: 1, container_scanning: 2, dast: 3 } } let(:report_types) { { sast: 0, dependency_scanning: 1, container_scanning: 2, dast: 3 } }
......
...@@ -7,6 +7,7 @@ RSpec.describe SetResolvedStateOnVulnerabilities do ...@@ -7,6 +7,7 @@ RSpec.describe SetResolvedStateOnVulnerabilities do
let(:confidence_levels) do let(:confidence_levels) do
{ undefined: 0, ignore: 1, unknown: 2, experimental: 3, low: 4, medium: 5, high: 6, confirmed: 7 } { undefined: 0, ignore: 1, unknown: 2, experimental: 3, low: 4, medium: 5, high: 6, confirmed: 7 }
end end
let(:severity_levels) { { undefined: 0, info: 1, unknown: 2, low: 4, medium: 5, high: 6, critical: 7 } } let(:severity_levels) { { undefined: 0, info: 1, unknown: 2, low: 4, medium: 5, high: 6, critical: 7 } }
let(:states) { { opened: 1, closed: 2, resolved: 3 } } let(:states) { { opened: 1, closed: 2, resolved: 3 } }
let(:report_types) { { sast: 0, dependency_scanning: 1, container_scanning: 2, dast: 3 } } let(:report_types) { { sast: 0, dependency_scanning: 1, container_scanning: 2, dast: 3 } }
......
...@@ -160,6 +160,7 @@ RSpec.describe Burndown do ...@@ -160,6 +160,7 @@ RSpec.describe Burndown do
author: user author: user
} }
end end
let(:scope) { project } let(:scope) { project }
end end
end end
...@@ -188,6 +189,7 @@ RSpec.describe Burndown do ...@@ -188,6 +189,7 @@ RSpec.describe Burndown do
author: user author: user
} }
end end
let(:scope) { group } let(:scope) { group }
end end
end end
...@@ -204,6 +206,7 @@ RSpec.describe Burndown do ...@@ -204,6 +206,7 @@ RSpec.describe Burndown do
author: user author: user
} }
end end
let(:scope) { group } let(:scope) { group }
end end
end end
......
...@@ -519,6 +519,7 @@ RSpec.describe Ci::Build do ...@@ -519,6 +519,7 @@ RSpec.describe Ci::Build do
} }
} }
end end
let(:build) { create(:ci_build, secrets: secrets) } let(:build) { create(:ci_build, secrets: secrets) }
subject { build.runner_required_feature_names } subject { build.runner_required_feature_names }
......
...@@ -23,6 +23,7 @@ RSpec.describe ElasticsearchIndexedNamespace do ...@@ -23,6 +23,7 @@ RSpec.describe ElasticsearchIndexedNamespace do
let(:index_action) do let(:index_action) do
expect(ElasticNamespaceIndexerWorker).to receive(:perform_async).with(subject.namespace_id, :index) expect(ElasticNamespaceIndexerWorker).to receive(:perform_async).with(subject.namespace_id, :index)
end end
let(:delete_action) do let(:delete_action) do
expect(ElasticNamespaceIndexerWorker).to receive(:perform_async).with(subject.namespace_id, :delete) expect(ElasticNamespaceIndexerWorker).to receive(:perform_async).with(subject.namespace_id, :delete)
end end
......
...@@ -13,6 +13,7 @@ RSpec.describe ElasticsearchIndexedProject do ...@@ -13,6 +13,7 @@ RSpec.describe ElasticsearchIndexedProject do
let(:index_action) do let(:index_action) do
expect(Elastic::ProcessBookkeepingService).to receive(:track!).with(subject.project) expect(Elastic::ProcessBookkeepingService).to receive(:track!).with(subject.project)
end end
let(:delete_action) do let(:delete_action) do
expect(ElasticDeleteProjectWorker).to receive(:perform_async).with(subject.project.id, subject.project.es_id) expect(ElasticDeleteProjectWorker).to receive(:perform_async).with(subject.project.id, subject.project.es_id)
end end
......
...@@ -129,9 +129,11 @@ RSpec.describe GroupMember do ...@@ -129,9 +129,11 @@ RSpec.describe GroupMember do
create(:group_saml_identity, saml_provider: saml_provider, user: m.user) create(:group_saml_identity, saml_provider: saml_provider, user: m.user)
end end
end end
let!(:member_without_identity) do let!(:member_without_identity) do
create(:group_member, group: group) create(:group_member, group: group)
end end
let!(:member_with_different_identity) do let!(:member_with_different_identity) do
create(:group_member, group: group).tap do |m| create(:group_member, group: group).tap do |m|
create(:group_saml_identity, user: m.user) create(:group_saml_identity, user: m.user)
......
...@@ -220,6 +220,7 @@ RSpec.describe Operations::FeatureFlag do ...@@ -220,6 +220,7 @@ RSpec.describe Operations::FeatureFlag do
create(:operations_feature_flag, project: project, create(:operations_feature_flag, project: project,
name: 'feature1', active: true, version: 2) name: 'feature1', active: true, version: 2)
end end
let!(:strategy) do let!(:strategy) do
create(:operations_strategy, feature_flag: feature_flag, create(:operations_strategy, feature_flag: feature_flag,
name: 'default', parameters: {}) name: 'default', parameters: {})
......
...@@ -9,6 +9,7 @@ RSpec.describe Vulnerability do ...@@ -9,6 +9,7 @@ RSpec.describe Vulnerability do
let(:confidence_values) do let(:confidence_values) do
{ ignore: 1, unknown: 2, experimental: 3, low: 4, medium: 5, high: 6, confirmed: 7 } { ignore: 1, unknown: 2, experimental: 3, low: 4, medium: 5, high: 6, confirmed: 7 }
end end
let(:report_types) do let(:report_types) do
{ sast: 0, { sast: 0,
dependency_scanning: 1, dependency_scanning: 1,
......
...@@ -40,9 +40,11 @@ RSpec.describe ProjectPolicy do ...@@ -40,9 +40,11 @@ RSpec.describe ProjectPolicy do
let(:additional_guest_permissions) do let(:additional_guest_permissions) do
%i[read_issue_link] %i[read_issue_link]
end end
let(:additional_reporter_permissions) do let(:additional_reporter_permissions) do
%i[read_software_license_policy admin_issue_link] %i[read_software_license_policy admin_issue_link]
end end
let(:additional_developer_permissions) do let(:additional_developer_permissions) do
%i[ %i[
admin_vulnerability_feedback read_project_security_dashboard read_feature_flag admin_vulnerability_feedback read_project_security_dashboard read_feature_flag
...@@ -50,9 +52,11 @@ RSpec.describe ProjectPolicy do ...@@ -50,9 +52,11 @@ RSpec.describe ProjectPolicy do
admin_vulnerability_issue_link read_merge_train admin_vulnerability_issue_link read_merge_train
] ]
end end
let(:additional_maintainer_permissions) do let(:additional_maintainer_permissions) do
%i[push_code_to_protected_branches admin_feature_flags_client modify_auto_fix_setting] %i[push_code_to_protected_branches admin_feature_flags_client modify_auto_fix_setting]
end end
let(:auditor_permissions) do let(:auditor_permissions) do
%i[ %i[
download_code download_wiki_code read_project read_board read_list download_code download_wiki_code read_project read_board read_list
......
...@@ -156,6 +156,7 @@ RSpec.describe API::Epics do ...@@ -156,6 +156,7 @@ RSpec.describe API::Epics do
created_at: 3.days.ago, created_at: 3.days.ago,
updated_at: 2.days.ago) updated_at: 2.days.ago)
end end
let!(:epic2) do let!(:epic2) do
create(:epic, create(:epic,
author: user2, author: user2,
...@@ -165,6 +166,7 @@ RSpec.describe API::Epics do ...@@ -165,6 +166,7 @@ RSpec.describe API::Epics do
created_at: 2.days.ago, created_at: 2.days.ago,
updated_at: 3.days.ago) updated_at: 3.days.ago)
end end
let!(:label) { create(:group_label, title: 'a-test', group: group) } let!(:label) { create(:group_label, title: 'a-test', group: group) }
let!(:label_link) { create(:label_link, label: label, target: epic2) } let!(:label_link) { create(:label_link, label: label, target: epic2) }
......
...@@ -105,9 +105,11 @@ RSpec.describe API::FeatureFlags do ...@@ -105,9 +105,11 @@ RSpec.describe API::FeatureFlags do
let!(:feature_flag) do let!(:feature_flag) do
create(:operations_feature_flag, :new_version_flag, project: project, name: 'feature1') create(:operations_feature_flag, :new_version_flag, project: project, name: 'feature1')
end end
let!(:strategy) do let!(:strategy) do
create(:operations_strategy, feature_flag: feature_flag, name: 'default', parameters: {}) create(:operations_strategy, feature_flag: feature_flag, name: 'default', parameters: {})
end end
let!(:scope) do let!(:scope) do
create(:operations_scope, strategy: strategy, environment_scope: 'production') create(:operations_scope, strategy: strategy, environment_scope: 'production')
end end
......
...@@ -14,6 +14,7 @@ RSpec.describe API::Geo do ...@@ -14,6 +14,7 @@ RSpec.describe API::Geo do
let(:geo_token_header) do let(:geo_token_header) do
{ 'X-Gitlab-Token' => secondary_node.system_hook.token } { 'X-Gitlab-Token' => secondary_node.system_hook.token }
end end
let(:invalid_geo_auth_header) do let(:invalid_geo_auth_header) do
{ Authorization: "#{::Gitlab::Geo::BaseRequest::GITLAB_GEO_AUTH_TOKEN_TYPE}...Test" } { Authorization: "#{::Gitlab::Geo::BaseRequest::GITLAB_GEO_AUTH_TOKEN_TYPE}...Test" }
end end
......
...@@ -14,6 +14,7 @@ RSpec.describe 'getting project information' do ...@@ -14,6 +14,7 @@ RSpec.describe 'getting project information' do
} }
QUERY QUERY
end end
let(:query) do let(:query) do
graphql_query_for('currentUser', {}, query_graphql_field('todos', {}, fields)) graphql_query_for('currentUser', {}, query_graphql_field('todos', {}, fields))
end end
......
...@@ -30,6 +30,7 @@ RSpec.describe 'Getting the current Geo node' do ...@@ -30,6 +30,7 @@ RSpec.describe 'Getting the current Geo node' do
} }
QUERY QUERY
end end
let(:current_user) { create(:user, :admin) } let(:current_user) { create(:user, :admin) }
before do before do
......
...@@ -13,6 +13,7 @@ RSpec.describe 'Epic aggregates (count and weight)' do ...@@ -13,6 +13,7 @@ RSpec.describe 'Epic aggregates (count and weight)' do
let(:query) do let(:query) do
graphql_query_for('group', { fullPath: target_epic.group.full_path }, query_graphql_field('epics', { iid: target_epic.iid }, epic_aggregates_query)) graphql_query_for('group', { fullPath: target_epic.group.full_path }, query_graphql_field('epics', { iid: target_epic.iid }, epic_aggregates_query))
end end
let(:epic_aggregates_query) do let(:epic_aggregates_query) do
<<~QUERY <<~QUERY
nodes { nodes {
......
...@@ -19,6 +19,7 @@ RSpec.describe API::Helpers do ...@@ -19,6 +19,7 @@ RSpec.describe API::Helpers do
'CONTENT_TYPE' => 'text/plain;charset=utf-8' 'CONTENT_TYPE' => 'text/plain;charset=utf-8'
} }
end end
let(:header) { } let(:header) { }
let(:request) { Grape::Request.new(env)} let(:request) { Grape::Request.new(env)}
let(:params) { request.params } let(:params) { request.params }
......
...@@ -208,6 +208,7 @@ RSpec.describe API::Internal::Base do ...@@ -208,6 +208,7 @@ RSpec.describe API::Internal::Base do
protocol: 'ssh' protocol: 'ssh'
} }
end end
let(:allowed_ip) { '150.168.0.1' } let(:allowed_ip) { '150.168.0.1' }
before do before do
......
...@@ -103,6 +103,7 @@ RSpec.describe API::License, api: true do ...@@ -103,6 +103,7 @@ RSpec.describe API::License, api: true do
[build(:gitlab_license, starts_at: Date.today - 10, expires_at: Date.today - 1, restrictions: { add_ons: { 'GitLab_FileLocks' => 1 }, active_user_count: 10 }), [build(:gitlab_license, starts_at: Date.today - 10, expires_at: Date.today - 1, restrictions: { add_ons: { 'GitLab_FileLocks' => 1 }, active_user_count: 10 }),
build(:gitlab_license, starts_at: Date.today - 20, expires_at: Date.today + 1, restrictions: { add_ons: { 'GitLab_DeployBoard' => 1 }, active_user_count: 20 })] build(:gitlab_license, starts_at: Date.today - 20, expires_at: Date.today + 1, restrictions: { add_ons: { 'GitLab_DeployBoard' => 1 }, active_user_count: 20 })]
end end
let!(:licenses) do let!(:licenses) do
[create(:license, created_at: Time.now + 30, data: gl_licenses[0].export), [create(:license, created_at: Time.now + 30, data: gl_licenses[0].export),
create(:license, created_at: Time.now + 20, data: gl_licenses[1].export)] create(:license, created_at: Time.now + 20, data: gl_licenses[1].export)]
......
...@@ -154,6 +154,7 @@ RSpec.describe API::MergeRequestApprovalRules do ...@@ -154,6 +154,7 @@ RSpec.describe API::MergeRequestApprovalRules do
group_ids: group_ids group_ids: group_ids
} }
end end
let(:user_ids) { [] } let(:user_ids) { [] }
let(:group_ids) { [] } let(:group_ids) { [] }
......
...@@ -930,6 +930,7 @@ RSpec.describe API::Projects do ...@@ -930,6 +930,7 @@ RSpec.describe API::Projects do
let!(:target_namespace) do let!(:target_namespace) do
create(:group).tap { |g| g.add_owner(user) } create(:group).tap { |g| g.add_owner(user) }
end end
let!(:group_project) { create(:project, namespace: group)} let!(:group_project) { create(:project, namespace: group)}
let(:group) { create(:group) } let(:group) { create(:group) }
...@@ -941,6 +942,7 @@ RSpec.describe API::Projects do ...@@ -941,6 +942,7 @@ RSpec.describe API::Projects do
let(:group) do let(:group) do
create(:saml_provider, :enforced_group_managed_accounts, prohibited_outer_forks: true).group create(:saml_provider, :enforced_group_managed_accounts, prohibited_outer_forks: true).group
end end
let(:user) do let(:user) do
create(:user, managing_group: group).tap do |u| create(:user, managing_group: group).tap do |u|
create(:group_saml_identity, user: u, saml_provider: group.saml_provider) create(:group_saml_identity, user: u, saml_provider: group.saml_provider)
......
...@@ -179,6 +179,7 @@ RSpec.describe API::Settings, 'EE Settings' do ...@@ -179,6 +179,7 @@ RSpec.describe API::Settings, 'EE Settings' do
prevent_merge_requests_committers_approval: true prevent_merge_requests_committers_approval: true
} }
end end
let(:feature) { :admin_merge_request_approvers_rules } let(:feature) { :admin_merge_request_approvers_rules }
it_behaves_like 'settings for licensed features' it_behaves_like 'settings for licensed features'
...@@ -202,6 +203,7 @@ RSpec.describe API::Settings, 'EE Settings' do ...@@ -202,6 +203,7 @@ RSpec.describe API::Settings, 'EE Settings' do
maintenance_mode_message: 'GitLab is in maintenance' maintenance_mode_message: 'GitLab is in maintenance'
} }
end end
let(:feature) { :geo } let(:feature) { :geo }
it_behaves_like 'settings for licensed features' it_behaves_like 'settings for licensed features'
......
...@@ -46,6 +46,7 @@ RSpec.describe API::V3::Github do ...@@ -46,6 +46,7 @@ RSpec.describe API::V3::Github do
let(:merge_request) do let(:merge_request) do
create(:merge_request, source_project: project, target_project: project) create(:merge_request, source_project: project, target_project: project)
end end
let!(:note) do let!(:note) do
create(:note, project: project, noteable: merge_request) create(:note, project: project, noteable: merge_request)
end end
...@@ -203,6 +204,7 @@ RSpec.describe API::V3::Github do ...@@ -203,6 +204,7 @@ RSpec.describe API::V3::Github do
let!(:merge_request) do let!(:merge_request) do
create(:merge_request, source_project: project, target_project: project, author: user, assignees: [assignee]) create(:merge_request, source_project: project, target_project: project, author: user, assignees: [assignee])
end end
let!(:merge_request_2) do let!(:merge_request_2) do
create(:merge_request, source_project: project2, target_project: project2, author: user, assignees: [assignee, assignee2]) create(:merge_request, source_project: project2, target_project: project2, author: user, assignees: [assignee, assignee2])
end end
......
...@@ -14,6 +14,7 @@ RSpec.describe 'Git LFS API and storage' do ...@@ -14,6 +14,7 @@ RSpec.describe 'Git LFS API and storage' do
'X-Sendfile-Type' => sendfile 'X-Sendfile-Type' => sendfile
}.compact }.compact
end end
let(:authorization) { } let(:authorization) { }
let(:sendfile) { } let(:sendfile) { }
......
...@@ -9,6 +9,7 @@ RSpec.describe Projects::MirrorsController do ...@@ -9,6 +9,7 @@ RSpec.describe Projects::MirrorsController do
mirror_user: user, mirror_user: user,
import_url: 'http://user:pass@test.url') import_url: 'http://user:pass@test.url')
end end
let(:user) { create(:user) } let(:user) { create(:user) }
describe 'updates the mirror URL' do describe 'updates the mirror URL' do
......
...@@ -299,6 +299,7 @@ RSpec.describe SmartcardController, type: :request do ...@@ -299,6 +299,7 @@ RSpec.describe SmartcardController, type: :request do
entry['mail'] = ldap_email entry['mail'] = ldap_email
end end
end end
let(:ldap_user_search_scope) { 'dc=example,dc=com' } let(:ldap_user_search_scope) { 'dc=example,dc=com' }
let(:ldap_search_params) do let(:ldap_search_params) do
{ attributes: array_including('dn', 'cn', 'mail', 'uid', 'userid'), { attributes: array_including('dn', 'cn', 'mail', 'uid', 'userid'),
......
...@@ -15,6 +15,7 @@ RSpec.describe UserAnalyticsEntity do ...@@ -15,6 +15,7 @@ RSpec.describe UserAnalyticsEntity do
total_events: {} total_events: {}
} }
end end
let(:request) { double('request', data_collector: instance_double(Gitlab::ContributionAnalytics::DataCollector, totals: events)) } let(:request) { double('request', data_collector: instance_double(Gitlab::ContributionAnalytics::DataCollector, totals: events)) }
subject(:json) { described_class.new(user, request: request).as_json } subject(:json) { described_class.new(user, request: request).as_json }
......
...@@ -76,6 +76,7 @@ RSpec.describe ApprovalRules::ParamsFilteringService do ...@@ -76,6 +76,7 @@ RSpec.describe ApprovalRules::ParamsFilteringService do
{ name: 'bar', user_ids: [outsider.id], group_ids: [accessible_group.id, inaccessible_group.id] } { name: 'bar', user_ids: [outsider.id], group_ids: [accessible_group.id, inaccessible_group.id] }
] ]
end end
let(:expected_groups) { [accessible_group] } let(:expected_groups) { [accessible_group] }
end end
...@@ -203,6 +204,7 @@ RSpec.describe ApprovalRules::ParamsFilteringService do ...@@ -203,6 +204,7 @@ RSpec.describe ApprovalRules::ParamsFilteringService do
] ]
} }
end end
let(:expected_groups) { [accessible_group, existing_private_group] } let(:expected_groups) { [accessible_group, existing_private_group] }
end end
...@@ -294,6 +296,7 @@ RSpec.describe ApprovalRules::ParamsFilteringService do ...@@ -294,6 +296,7 @@ RSpec.describe ApprovalRules::ParamsFilteringService do
] ]
} }
end end
let(:expected_groups) { [accessible_group] } let(:expected_groups) { [accessible_group] }
end end
end end
......
...@@ -52,6 +52,7 @@ RSpec.describe Dashboard::Operations::ListService do ...@@ -52,6 +52,7 @@ RSpec.describe Dashboard::Operations::ListService do
let(:production_deployment) do let(:production_deployment) do
create(:deployment, :success, project: project, environment: production, ref: 'master') create(:deployment, :success, project: project, environment: production, ref: 'master')
end end
let(:staging_deployment) do let(:staging_deployment) do
create(:deployment, :success, project: project, environment: staging, ref: 'wip') create(:deployment, :success, project: project, environment: staging, ref: 'wip')
end end
......
...@@ -14,6 +14,7 @@ RSpec.describe EE::AuditEvents::BulkInsertService do ...@@ -14,6 +14,7 @@ RSpec.describe EE::AuditEvents::BulkInsertService do
EE::AuditEvents::RepositoryPushAuditEventService.new(user, entity, target_ref, from, to) EE::AuditEvents::RepositoryPushAuditEventService.new(user, entity, target_ref, from, to)
end end
end end
let(:timestamp) { Time.zone.local(2019, 10, 10) } let(:timestamp) { Time.zone.local(2019, 10, 10) }
let(:attrs) do let(:attrs) do
{ {
......
...@@ -135,6 +135,7 @@ RSpec.describe Issues::CreateFromVulnerabilityDataService, '#execute' do ...@@ -135,6 +135,7 @@ RSpec.describe Issues::CreateFromVulnerabilityDataService, '#execute' do
tool: 'find_sec_bugs' tool: 'find_sec_bugs'
} }
end end
let(:expected_title) { 'Investigate vulnerability: Predictable pseudorandom number generator' } let(:expected_title) { 'Investigate vulnerability: Predictable pseudorandom number generator' }
let(:expected_description) do let(:expected_description) do
<<~DESC.chomp <<~DESC.chomp
...@@ -193,6 +194,7 @@ RSpec.describe Issues::CreateFromVulnerabilityDataService, '#execute' do ...@@ -193,6 +194,7 @@ RSpec.describe Issues::CreateFromVulnerabilityDataService, '#execute' do
}] }]
} }
end end
let(:expected_title) { 'Investigate vulnerability: Predictable pseudorandom number generator' } let(:expected_title) { 'Investigate vulnerability: Predictable pseudorandom number generator' }
let(:expected_description) do let(:expected_description) do
<<~DESC.chomp <<~DESC.chomp
...@@ -238,6 +240,7 @@ RSpec.describe Issues::CreateFromVulnerabilityDataService, '#execute' do ...@@ -238,6 +240,7 @@ RSpec.describe Issues::CreateFromVulnerabilityDataService, '#execute' do
tool: 'find_sec_bugs' tool: 'find_sec_bugs'
} }
end end
let(:expected_title) { 'Investigate vulnerability: Predictable pseudorandom number generator' } let(:expected_title) { 'Investigate vulnerability: Predictable pseudorandom number generator' }
let(:expected_description) do let(:expected_description) do
<<~DESC.chomp <<~DESC.chomp
...@@ -282,6 +285,7 @@ RSpec.describe Issues::CreateFromVulnerabilityDataService, '#execute' do ...@@ -282,6 +285,7 @@ RSpec.describe Issues::CreateFromVulnerabilityDataService, '#execute' do
}] }]
} }
end end
let(:expected_title) { 'Investigate vulnerability: CVE-2017-15650 in musl' } let(:expected_title) { 'Investigate vulnerability: CVE-2017-15650 in musl' }
let(:expected_description) do let(:expected_description) do
<<~DESC.chomp <<~DESC.chomp
...@@ -325,6 +329,7 @@ RSpec.describe Issues::CreateFromVulnerabilityDataService, '#execute' do ...@@ -325,6 +329,7 @@ RSpec.describe Issues::CreateFromVulnerabilityDataService, '#execute' do
}] }]
} }
end end
let(:expected_title) { 'Investigate vulnerability: CVE-2017-15650 in musl' } let(:expected_title) { 'Investigate vulnerability: CVE-2017-15650 in musl' }
let(:expected_description) do let(:expected_description) do
<<~DESC.chomp <<~DESC.chomp
...@@ -372,6 +377,7 @@ RSpec.describe Issues::CreateFromVulnerabilityDataService, '#execute' do ...@@ -372,6 +377,7 @@ RSpec.describe Issues::CreateFromVulnerabilityDataService, '#execute' do
}] }]
} }
end end
let(:expected_title) { 'Investigate vulnerability: X-Content-Type-Options Header Missing' } let(:expected_title) { 'Investigate vulnerability: X-Content-Type-Options Header Missing' }
let(:expected_description) do let(:expected_description) do
<<~DESC.chomp <<~DESC.chomp
......
...@@ -128,6 +128,7 @@ RSpec.describe MergeRequests::CreateFromVulnerabilityDataService, '#execute' do ...@@ -128,6 +128,7 @@ RSpec.describe MergeRequests::CreateFromVulnerabilityDataService, '#execute' do
urlPath: "/root/yarn-remediation/blob/9bade3fef995a9e2ca1de44d396b433864990ab9/yarn.lock" urlPath: "/root/yarn-remediation/blob/9bade3fef995a9e2ca1de44d396b433864990ab9/yarn.lock"
} }
end end
let(:expected_title) { 'Resolve vulnerability: Authentication bypass via incorrect DOM traversal and canonicalization in saml2-js' } let(:expected_title) { 'Resolve vulnerability: Authentication bypass via incorrect DOM traversal and canonicalization in saml2-js' }
let(:expected_description) do let(:expected_description) do
<<~DESC.chomp <<~DESC.chomp
...@@ -173,6 +174,7 @@ RSpec.describe MergeRequests::CreateFromVulnerabilityDataService, '#execute' do ...@@ -173,6 +174,7 @@ RSpec.describe MergeRequests::CreateFromVulnerabilityDataService, '#execute' do
] ]
} }
end end
let(:expected_title) { 'Resolve vulnerability: Authentication bypass via incorrect DOM traversal and canonicalization in saml2-js' } let(:expected_title) { 'Resolve vulnerability: Authentication bypass via incorrect DOM traversal and canonicalization in saml2-js' }
let(:expected_description) do let(:expected_description) do
<<~DESC.chomp <<~DESC.chomp
......
...@@ -20,6 +20,7 @@ RSpec.describe MergeRequests::RefreshService do ...@@ -20,6 +20,7 @@ RSpec.describe MergeRequests::RefreshService do
target_branch: 'master', target_branch: 'master',
target_project: project) target_project: project)
end end
let(:another_merge_request) do let(:another_merge_request) do
create(:merge_request, create(:merge_request,
source_project: project, source_project: project,
...@@ -27,6 +28,7 @@ RSpec.describe MergeRequests::RefreshService do ...@@ -27,6 +28,7 @@ RSpec.describe MergeRequests::RefreshService do
target_branch: 'test', target_branch: 'test',
target_project: project) target_project: project)
end end
let(:forked_merge_request) do let(:forked_merge_request) do
create(:merge_request, create(:merge_request,
source_project: forked_project, source_project: forked_project,
...@@ -34,6 +36,7 @@ RSpec.describe MergeRequests::RefreshService do ...@@ -34,6 +36,7 @@ RSpec.describe MergeRequests::RefreshService do
target_branch: 'master', target_branch: 'master',
target_project: project) target_project: project)
end end
let(:oldrev) { TestEnv::BRANCH_SHA[source_branch] } let(:oldrev) { TestEnv::BRANCH_SHA[source_branch] }
let(:newrev) { TestEnv::BRANCH_SHA['after-create-delete-modify-move'] } # Pretend source_branch is now updated let(:newrev) { TestEnv::BRANCH_SHA['after-create-delete-modify-move'] } # Pretend source_branch is now updated
let(:service) { described_class.new(project, current_user) } let(:service) { described_class.new(project, current_user) }
......
...@@ -15,6 +15,7 @@ RSpec.describe PreviewMarkdownService do ...@@ -15,6 +15,7 @@ RSpec.describe PreviewMarkdownService do
group: epic.group group: epic.group
} }
end end
let(:service) { described_class.new(nil, user, params) } let(:service) { described_class.new(nil, user, params) }
before do before do
......
...@@ -13,6 +13,7 @@ RSpec.describe Elastic::IndexingControlService, :clean_gitlab_redis_shared_state ...@@ -13,6 +13,7 @@ RSpec.describe Elastic::IndexingControlService, :clean_gitlab_redis_shared_state
prepend Elastic::IndexingControl prepend Elastic::IndexingControl
end end
end end
let(:worker_args) { [1, 2] } let(:worker_args) { [1, 2] }
let(:worker_context) { { 'correlation_id' => 'context_correlation_id' } } let(:worker_context) { { 'correlation_id' => 'context_correlation_id' } }
...@@ -131,6 +132,7 @@ RSpec.describe Elastic::IndexingControlService, :clean_gitlab_redis_shared_state ...@@ -131,6 +132,7 @@ RSpec.describe Elastic::IndexingControlService, :clean_gitlab_redis_shared_state
prepend Elastic::IndexingControl prepend Elastic::IndexingControl
end end
end end
let(:other_subject) { described_class.new(second_worker_class) } let(:other_subject) { described_class.new(second_worker_class) }
it 'allows to use queues independently of each other' do it 'allows to use queues independently of each other' do
......
...@@ -32,6 +32,7 @@ RSpec.describe Epics::UpdateDatesService do ...@@ -32,6 +32,7 @@ RSpec.describe Epics::UpdateDatesService do
group: group group: group
) )
end end
let(:milestone2) do let(:milestone2) do
create( create(
:milestone, :milestone,
...@@ -69,6 +70,7 @@ RSpec.describe Epics::UpdateDatesService do ...@@ -69,6 +70,7 @@ RSpec.describe Epics::UpdateDatesService do
group: group group: group
) )
end end
let(:milestone2) do let(:milestone2) do
create( create(
:milestone, :milestone,
...@@ -96,6 +98,7 @@ RSpec.describe Epics::UpdateDatesService do ...@@ -96,6 +98,7 @@ RSpec.describe Epics::UpdateDatesService do
group: group group: group
) )
end end
let(:milestone2) do let(:milestone2) do
create( create(
:milestone, :milestone,
......
...@@ -171,6 +171,7 @@ RSpec.describe Epics::UpdateService do ...@@ -171,6 +171,7 @@ RSpec.describe Epics::UpdateService do
author: user, author: user,
user: user) user: user)
end end
let!(:todo2) do let!(:todo2) do
create(:todo, :mentioned, :pending, create(:todo, :mentioned, :pending,
target: epic, target: epic,
......
...@@ -362,6 +362,7 @@ RSpec.describe Geo::FileRegistryRemovalService, :geo do ...@@ -362,6 +362,7 @@ RSpec.describe Geo::FileRegistryRemovalService, :geo do
PersonalFileUploader.new(snippet).store!(file) PersonalFileUploader.new(snippet).store!(file)
Upload.find_by(model: snippet, uploader: PersonalFileUploader.name) Upload.find_by(model: snippet, uploader: PersonalFileUploader.name)
end end
let!(:registry) { create(:geo_upload_registry, :personal_file, file_id: upload.id) } let!(:registry) { create(:geo_upload_registry, :personal_file, file_id: upload.id) }
let!(:file_path) { upload.retrieve_uploader.file.path } let!(:file_path) { upload.retrieve_uploader.file.path }
...@@ -392,6 +393,7 @@ RSpec.describe Geo::FileRegistryRemovalService, :geo do ...@@ -392,6 +393,7 @@ RSpec.describe Geo::FileRegistryRemovalService, :geo do
FaviconUploader.new(appearance).store!(file) FaviconUploader.new(appearance).store!(file)
Upload.find_by(model: appearance, uploader: FaviconUploader.name) Upload.find_by(model: appearance, uploader: FaviconUploader.name)
end end
let!(:registry) { create(:geo_upload_registry, :favicon, file_id: upload.id) } let!(:registry) { create(:geo_upload_registry, :favicon, file_id: upload.id) }
let!(:file_path) { upload.retrieve_uploader.file.path } let!(:file_path) { upload.retrieve_uploader.file.path }
......
...@@ -9,6 +9,7 @@ RSpec.describe GroupSaml::SamlProvider::UpdateService do ...@@ -9,6 +9,7 @@ RSpec.describe GroupSaml::SamlProvider::UpdateService do
let(:saml_provider) do let(:saml_provider) do
create :saml_provider, enabled: false, enforced_sso: false create :saml_provider, enabled: false, enforced_sso: false
end end
let(:group) { saml_provider.group } let(:group) { saml_provider.group }
include_examples 'base SamlProvider service' include_examples 'base SamlProvider service'
......
...@@ -18,6 +18,7 @@ RSpec.describe Groups::CreateService, '#execute' do ...@@ -18,6 +18,7 @@ RSpec.describe Groups::CreateService, '#execute' do
let(:fail_condition!) do let(:fail_condition!) do
allow(Gitlab::VisibilityLevel).to receive(:allowed_for?).and_return(false) allow(Gitlab::VisibilityLevel).to receive(:allowed_for?).and_return(false)
end end
let(:attributes) do let(:attributes) do
{ {
author_id: user.id, author_id: user.id,
......
...@@ -15,6 +15,7 @@ RSpec.describe Groups::DestroyService do ...@@ -15,6 +15,7 @@ RSpec.describe Groups::DestroyService do
expect_any_instance_of(Group) expect_any_instance_of(Group)
.to receive(:destroy).and_return(group) .to receive(:destroy).and_return(group)
end end
let(:attributes) do let(:attributes) do
{ {
author_id: user.id, author_id: user.id,
......
...@@ -30,6 +30,7 @@ RSpec.describe Groups::UpdateService, '#execute' do ...@@ -30,6 +30,7 @@ RSpec.describe Groups::UpdateService, '#execute' do
let(:operation) do let(:operation) do
update_group(group, user, visibility_level: Gitlab::VisibilityLevel::PRIVATE) update_group(group, user, visibility_level: Gitlab::VisibilityLevel::PRIVATE)
end end
let(:fail_condition!) do let(:fail_condition!) do
allow(group).to receive(:save).and_return(false) allow(group).to receive(:save).and_return(false)
end end
......
...@@ -356,6 +356,7 @@ RSpec.describe Projects::CreateService, '#execute' do ...@@ -356,6 +356,7 @@ RSpec.describe Projects::CreateService, '#execute' do
let(:fail_condition!) do let(:fail_condition!) do
allow(Gitlab::VisibilityLevel).to receive(:allowed_for?).and_return(false) allow(Gitlab::VisibilityLevel).to receive(:allowed_for?).and_return(false)
end end
let(:attributes) do let(:attributes) do
{ {
author_id: user.id, author_id: user.id,
......
...@@ -67,6 +67,7 @@ RSpec.describe Projects::DestroyService do ...@@ -67,6 +67,7 @@ RSpec.describe Projects::DestroyService do
expect_any_instance_of(Project) expect_any_instance_of(Project)
.to receive(:destroy!).and_raise(StandardError.new('Other error message')) .to receive(:destroy!).and_raise(StandardError.new('Other error message'))
end end
let(:attributes) do let(:attributes) do
{ {
author_id: user.id, author_id: user.id,
......
...@@ -21,6 +21,7 @@ RSpec.describe Projects::GroupLinks::CreateService, '#execute' do ...@@ -21,6 +21,7 @@ RSpec.describe Projects::GroupLinks::CreateService, '#execute' do
let(:fail_condition!) do let(:fail_condition!) do
create(:project_group_link, project: project, group: group) create(:project_group_link, project: project, group: group)
end end
let(:attributes) do let(:attributes) do
{ {
author_id: user.id, author_id: user.id,
......
...@@ -17,6 +17,7 @@ RSpec.describe Projects::GroupLinks::DestroyService do ...@@ -17,6 +17,7 @@ RSpec.describe Projects::GroupLinks::DestroyService do
expect_any_instance_of(ProjectGroupLink) expect_any_instance_of(ProjectGroupLink)
.to receive(:destroy).and_return(group_link) .to receive(:destroy).and_return(group_link)
end end
let(:attributes) do let(:attributes) do
{ {
author_id: user.id, author_id: user.id,
......
...@@ -33,6 +33,7 @@ RSpec.describe Projects::Prometheus::Alerts::NotifyService do ...@@ -33,6 +33,7 @@ RSpec.describe Projects::Prometheus::Alerts::NotifyService do
let(:prd_cluster) do let(:prd_cluster) do
create(:cluster, :provided_by_user, projects: [project], enabled: true, environment_scope: '*') create(:cluster, :provided_by_user, projects: [project], enabled: true, environment_scope: '*')
end end
let(:stg_cluster) do let(:stg_cluster) do
create(:cluster, :provided_by_user, projects: [project], enabled: true, environment_scope: 'stg/*') create(:cluster, :provided_by_user, projects: [project], enabled: true, environment_scope: 'stg/*')
end end
......
...@@ -34,6 +34,7 @@ RSpec.describe Projects::TransferService do ...@@ -34,6 +34,7 @@ RSpec.describe Projects::TransferService do
expect(instance).to receive(:has_container_registry_tags?).and_return(true) expect(instance).to receive(:has_container_registry_tags?).and_return(true)
end end
end end
let(:attributes) do let(:attributes) do
{ {
author_id: user.id, author_id: user.id,
......
...@@ -113,6 +113,7 @@ RSpec.describe Projects::UpdateService, '#execute' do ...@@ -113,6 +113,7 @@ RSpec.describe Projects::UpdateService, '#execute' do
let(:operation) do let(:operation) do
update_project(project, user, visibility_level: Gitlab::VisibilityLevel::INTERNAL) update_project(project, user, visibility_level: Gitlab::VisibilityLevel::INTERNAL)
end end
let(:fail_condition!) do let(:fail_condition!) do
allow_any_instance_of(Project).to receive(:update).and_return(false) allow_any_instance_of(Project).to receive(:update).and_return(false)
end end
......
...@@ -39,6 +39,7 @@ RSpec.describe Search::SnippetService do ...@@ -39,6 +39,7 @@ RSpec.describe Search::SnippetService do
{ snippet_level: :internal, project_level: :internal, feature_access_level: :enabled, membership: :non_member, expected_count: 1 } { snippet_level: :internal, project_level: :internal, feature_access_level: :enabled, membership: :non_member, expected_count: 1 }
] ]
end end
let(:pending?) do let(:pending?) do
pendings.include?( pendings.include?(
{ {
......
...@@ -173,10 +173,12 @@ RSpec.describe TodoService do ...@@ -173,10 +173,12 @@ RSpec.describe TodoService do
create(:todo, :assigned, create(:todo, :assigned,
user: john_doe, project: nil, group: group, target: epic, author: author) user: john_doe, project: nil, group: group, target: epic, author: author)
end end
let!(:second_todo) do let!(:second_todo) do
create(:todo, :assigned, create(:todo, :assigned,
user: john_doe, project: nil, group: group, target: epic, author: author) user: john_doe, project: nil, group: group, target: epic, author: author)
end end
let(:note) { create(:note, noteable: epic, project: nil, author: john_doe, note: mentions) } let(:note) { create(:note, noteable: epic, project: nil, author: john_doe, note: mentions) }
context 'when a note is created for an epic' do context 'when a note is created for an epic' do
......
...@@ -28,6 +28,7 @@ RSpec.shared_examples 'gets registries for' do |args| ...@@ -28,6 +28,7 @@ RSpec.shared_examples 'gets registries for' do |args|
} }
QUERY QUERY
end end
let(:current_user) { create(:user, :admin) } let(:current_user) { create(:user, :admin) }
before do before do
......
...@@ -21,6 +21,7 @@ RSpec.describe Elastic::IndexingControl do ...@@ -21,6 +21,7 @@ RSpec.describe Elastic::IndexingControl do
prepend Elastic::IndexingControl prepend Elastic::IndexingControl
end.new end.new
end end
let(:worker_args) { [project.id] } let(:worker_args) { [project.id] }
let(:worker_context) { { 'correlation_id' => 'context_correlation_id' } } let(:worker_context) { { 'correlation_id' => 'context_correlation_id' } }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment