Commit 6a57e5d0 authored by Oghenerukevwe Kofi's avatar Oghenerukevwe Kofi Committed by Luke Duncalfe

fix excluded files for RSpec/EmptyLineAfterFinalLetItBe cop

parent 16d1887f
This diff is collapsed.
......@@ -6,6 +6,7 @@ RSpec.describe 'CI shared runner limits' do
using RSpec::Parameterized::TableSyntax
let_it_be(:user) { create(:user) }
let(:project) { create(:project, :repository, namespace: group, shared_runners_enabled: true) }
let(:group) { create(:group) }
let(:pipeline) { create(:ci_empty_pipeline, project: project, sha: project.commit.sha, ref: 'master') }
......
......@@ -5,6 +5,7 @@ require 'spec_helper'
RSpec.describe 'Jira issues list' do
let_it_be(:project, refind: true) { create(:project) }
let_it_be(:jira_integration) { create(:jira_integration, project: project, issues_enabled: true, project_key: 'GL') }
let(:user) { create(:user) }
before do
......
......@@ -85,6 +85,7 @@ RSpec.describe 'Metrics rendering', :js, :kubeclient, :use_clean_rails_memory_st
end
let_it_be(:cluster) { create(:cluster, :provided_by_gcp, :project, projects: [project], user: user) }
let(:params) { [project.namespace.path, project.path, cluster.id] }
let(:query_params) { { group: 'Cluster Health', title: 'CPU Usage', y_label: 'CPU (cores)' } }
let(:metrics_url) { urls.metrics_namespace_project_cluster_url(*params, **query_params) }
......
......@@ -6,6 +6,7 @@ RSpec.describe 'User is able to invite members to group during signup', :js, :ex
include Select2Helper
let_it_be(:user) { create(:user, setup_for_company: true) }
let(:path_params) { {} }
before do
......
......@@ -6,6 +6,7 @@ RSpec.describe ::EE::API::Entities::UserWithAdmin do
subject { entity.as_json }
let_it_be(:user) { create(:user) }
let(:entity) { ::API::Entities::UserWithAdmin.new(user) }
context 'using_license_seat' do
......
......@@ -4,6 +4,7 @@ require 'spec_helper'
RSpec.describe ::EE::API::Entities::Vulnerability do
let_it_be(:project) { create(:project, :with_vulnerability) }
let(:vulnerability) { project.vulnerabilities.first }
subject { described_class.new(vulnerability).as_json }
......
......@@ -8,6 +8,7 @@ RSpec.describe EventFilter do
let_it_be(:project) { create(:project, :public) }
let_it_be(:epic_event) { create(:event, :created, group: group, target: create(:epic, group: group)) }
let_it_be(:issue_event) { create(:event, :created, project: project, target: create(:issue, project: project)) }
let(:filtered_events) { described_class.new(filter).apply_filter(Event.all) }
context 'with the "epic" filter' do
......
......@@ -4,6 +4,7 @@ require 'spec_helper'
RSpec.describe Gitlab::AlertManagement::Payload::Generic do
let_it_be(:project) { create(:project) }
let(:raw_payload) { {} }
let(:parsed_payload) { described_class.new(project: project, payload: raw_payload) }
......
......@@ -5,6 +5,7 @@ require 'spec_helper'
RSpec.describe Gitlab::AlertManagement::Payload do
describe '#parse' do
let_it_be(:project) { build_stubbed(:project) }
let(:payload) { {} }
context 'with the payload specifing cilium as monitoring tool' do
......
......@@ -6,6 +6,7 @@ RSpec.describe Gitlab::Ci::Pipeline::Chain::Validate::External do
let_it_be(:project) { create(:project) }
let_it_be(:user) { create(:user) }
let_it_be(:subscription) { create(:gitlab_subscription, :default, namespace: user.namespace) }
let(:pipeline) { build(:ci_empty_pipeline, user: user, project: project) }
let(:ci_yaml) do
......
......@@ -6,6 +6,7 @@ RSpec.describe EE::Gitlab::Ci::Pipeline::Quota::Activity do
let_it_be(:namespace) { create(:namespace) }
let_it_be(:project, reload: true) { create(:project, namespace: namespace) }
let_it_be(:ultimate_plan, reload: true) { create(:ultimate_plan) }
let(:plan_limits) { create(:plan_limits, plan: ultimate_plan) }
let!(:subscription) { create(:gitlab_subscription, namespace: namespace, hosted_plan: ultimate_plan) }
......
......@@ -7,6 +7,7 @@ RSpec.describe EE::Gitlab::Ci::Pipeline::Quota::JobActivity do
let_it_be(:project, reload: true) { create(:project, namespace: namespace) }
let_it_be(:ultimate_plan, reload: true) { create(:ultimate_plan) }
let_it_be(:plan_limits, reload: true) { create(:plan_limits, plan: ultimate_plan) }
let!(:subscription) { create(:gitlab_subscription, namespace: namespace, hosted_plan: ultimate_plan) }
subject { described_class.new(namespace, project) }
......
......@@ -7,6 +7,7 @@ RSpec.describe EE::Gitlab::Ci::Pipeline::Quota::Size do
let_it_be(:ultimate_plan, reload: true) { create(:ultimate_plan) }
let_it_be(:project, reload: true) { create(:project, :repository, namespace: namespace) }
let_it_be(:plan_limits) { create(:plan_limits, plan: ultimate_plan) }
let!(:subscription) { create(:gitlab_subscription, namespace: namespace, hosted_plan: ultimate_plan) }
let(:pipeline) { build_stubbed(:ci_pipeline, project: project) }
......
......@@ -7,6 +7,7 @@ RSpec.describe Gitlab::GitAccessDesign do
let_it_be(:project) { create(:project) }
let_it_be(:user) { project.owner }
let(:actor) { :geo }
subject(:access) do
......
......@@ -7,6 +7,7 @@ RSpec.describe Gitlab::GitAccessSnippet do
let_it_be(:user) { create(:user) }
let_it_be(:project) { create(:project, :public) }
let_it_be(:snippet) { create(:project_snippet, :public, :repository, project: project) }
let(:actor) { :geo }
let(:authentication_abilities) { [:read_project, :download_code, :push_code] }
......
......@@ -3,6 +3,7 @@ require 'spec_helper'
RSpec.describe Gitlab::HookData::IssueBuilder do
let_it_be(:issue) { create(:issue) }
let(:builder) { described_class.new(issue) }
describe '#build' do
......
......@@ -98,6 +98,7 @@ RSpec.describe Gitlab::ImportExport::Project::TreeRestorer do
describe 'security_settings' do
let_it_be(:project) { create(:project, name: 'project', path: 'project') }
let(:user) { create(:user)}
before do
......@@ -113,6 +114,7 @@ RSpec.describe Gitlab::ImportExport::Project::TreeRestorer do
describe 'push_rules' do
let_it_be(:project) { create(:project, name: 'project', path: 'project') }
let(:user) { create(:user)}
before do
......
......@@ -3,6 +3,7 @@ require 'spec_helper'
RSpec.describe Gitlab::SnippetSearchResults do
let_it_be(:snippet) { create(:snippet, title: 'foo', description: 'foo') }
let(:user) { snippet.author }
let(:com_value) { true }
......
......@@ -4,6 +4,7 @@ require 'spec_helper'
RSpec.describe Elastic::Latest::GitClassProxy, :elastic do
let_it_be(:project) { create(:project, :repository) }
let(:included_class) { Elastic::Latest::RepositoryClassProxy }
subject { included_class.new(project.repository) }
......
......@@ -4,6 +4,7 @@ require 'spec_helper'
RSpec.describe Gitlab::AlertManagement::Payload::Cilium do
let_it_be(:project) { build_stubbed(:project) }
let(:raw_payload) { build(:network_alert_payload) }
let(:parsed_payload) do
......
......@@ -32,6 +32,7 @@ RSpec.describe Gitlab::Checks::DiffCheck do
describe '#validate_code_owners?' do
let_it_be(:push_rule) { create(:push_rule, file_name_regex: 'READ*') }
let(:validate_code_owners) { subject.send(:validate_code_owners?) }
let(:protocol) { 'ssh' }
let(:push_allowed) { false }
......@@ -256,6 +257,7 @@ RSpec.describe Gitlab::Checks::DiffCheck do
context 'file lock rules' do
let_it_be(:push_rule) { create(:push_rule) }
let_it_be(:owner) { create(:user) }
let(:path_lock) { create(:path_lock, path: 'README', project: project) }
before do
......
......@@ -6,6 +6,7 @@ RSpec.describe Gitlab::CodeOwners::Loader do
include FakeBlobHelpers
let_it_be(:group) { create(:group) }
let_it_be(:project) { create(:project, namespace: group) }
subject(:loader) { described_class.new(project, 'with-codeowners', paths) }
let(:codeowner_content) do
......
......@@ -749,6 +749,7 @@ RSpec.describe Gitlab::GitAccess do
let_it_be(:user) { create(:user, :two_factor_via_otp)}
let_it_be(:key) { create(:key, user: user) }
let_it_be(:actor) { key }
let(:protocol) { 'ssh' }
before do
......
......@@ -7,6 +7,7 @@ RSpec.describe Gitlab::GitAccessWiki do
let_it_be(:user) { create(:user) }
let_it_be(:project) { create(:project, :wiki_repo) }
let(:wiki) { create(:project_wiki, project: project) }
let(:changes) { ['6f6d7e7ed 570e7b2ab refs/heads/master'] }
let(:authentication_abilities) { %i[read_project download_code push_code] }
......@@ -24,6 +25,7 @@ RSpec.describe Gitlab::GitAccessWiki do
describe 'group wiki access' do
let_it_be_with_refind(:group) { create(:group, :private, :wiki_repo) }
let(:wiki) { create(:group_wiki, group: group) }
describe '#push_access_check' do
......
......@@ -9,6 +9,7 @@ RSpec.describe Gitlab::Graphql::Aggregations::VulnerabilityStatistics::LazyAggre
let_it_be(:vulnerable) { create(:group) }
let_it_be(:other_vulnerable) { create(:group) }
let(:include_subgroups) { true }
describe '#initialize' do
......
......@@ -4,6 +4,7 @@ require 'spec_helper'
RSpec.describe Gitlab::Insights::ProjectInsightsConfig do
let_it_be(:project) { create(:project) }
let(:chart1) { { title: 'chart 1', description: 'description 1' } }
let(:chart2) { { title: 'chart 2', description: 'description 2' } }
......
......@@ -69,6 +69,7 @@ RSpec.describe Gitlab::Sitemaps::UrlExtractor do
describe '.extract_from_project' do
let_it_be_with_reload(:project) { create(:project) }
let(:project_feature) { project.project_feature }
subject { described_class.extract_from_project(project) }
......
......@@ -31,6 +31,7 @@ RSpec.describe API::Analytics::CodeReviewAnalytics do
context 'with merge requests present' do
let_it_be(:label) { create :label, project: project }
let_it_be(:milestone) { create :milestone, project: project }
let!(:merge_request_1) { create(:merge_request, :opened, source_project: project, target_branch: 'mr1') }
let!(:merge_request_2) { create(:labeled_merge_request, :opened, source_project: project, labels: [label], target_branch: 'mr2') }
let!(:merge_request_3) { create(:labeled_merge_request, :opened, source_project: project, labels: [label], milestone: milestone, target_branch: 'mr3') }
......
......@@ -156,6 +156,7 @@ RSpec.describe API::AuditEvents do
describe 'GET /audit_events/:id' do
let_it_be(:user_audit_event) { create(:user_audit_event, created_at: Date.new(2000, 1, 10)) }
let(:url) { "/audit_events/#{user_audit_event.id}" }
context 'when authenticated, as a user' do
......
......@@ -5,6 +5,7 @@ require "spec_helper"
RSpec.describe API::Commits do
let_it_be(:user) { create(:user) }
let_it_be(:project) { create(:project, :repository, creator: user, path: "my.project") }
let(:project_id) { project.id }
before do
......
......@@ -10,6 +10,7 @@ RSpec.describe API::Dora::Metrics do
let_it_be(:production) { create(:environment, :production, project: project) }
let_it_be(:maintainer) { create(:user) }
let_it_be(:guest) { create(:user) }
let(:url) { "/projects/#{project.id}/dora/metrics" }
let(:params) { { metric: :deployment_frequency } }
let(:user) { maintainer }
......@@ -59,6 +60,7 @@ RSpec.describe API::Dora::Metrics do
let_it_be(:production) { create(:environment, :production, project: project) }
let_it_be(:maintainer) { create(:user) }
let_it_be(:guest) { create(:user) }
let(:url) { "/groups/#{group.id}/dora/metrics" }
let(:params) { { metric: :deployment_frequency } }
let(:user) { maintainer }
......
......@@ -4,6 +4,7 @@ require 'spec_helper'
RSpec.describe API::Epics do
let_it_be(:user) { create(:user) }
let(:group) { create(:group) }
let(:project) { create(:project, :public, group: group) }
let(:label) { create(:group_label, group: group) }
......
......@@ -12,6 +12,7 @@ RSpec.describe API::Geo do
let_it_be(:user) { create(:user) }
let_it_be(:primary_node) { create(:geo_node, :primary) }
let_it_be(:secondary_node) { create(:geo_node) }
let(:geo_token_header) do
{ 'X-Gitlab-Token' => secondary_node.system_hook.token }
end
......@@ -46,6 +47,7 @@ RSpec.describe API::Geo do
end
let_it_be(:resource) { create(:package_file, :npm) }
let(:replicator) { Geo::PackageFileReplicator.new(model_record_id: resource.id) }
context 'valid requests' do
......
......@@ -19,6 +19,7 @@ RSpec.describe 'get list of epics for an epic board list' do
let_it_be(:epic_pos1) { create(:epic_board_position, epic: epic1, epic_board: board, relative_position: 20) }
let_it_be(:epic_pos2) { create(:epic_board_position, epic: epic2, epic_board: board, relative_position: 10) }
let(:data_path) { [:group, :epicBoard, :lists, :nodes, 0, :epics] }
def pagination_query(params = {})
......
......@@ -7,6 +7,7 @@ RSpec.describe 'getting project information' do
let_it_be(:current_user) { create(:user) }
let_it_be(:epic_todo) { create(:todo, user: current_user, target: create(:epic)) }
let(:fields) do
<<~QUERY
nodes {
......
......@@ -111,6 +111,7 @@ RSpec.describe 'Getting issues for an epic' do
let_it_be(:epic2) { create(:epic, group: group) }
let_it_be(:issue2) { create(:issue, project: project) }
let_it_be(:epic_issue3) { create(:epic_issue, epic: epic2, issue: issue2, relative_position: 3) }
let(:params) { { iids: [epic.iid, epic2.iid] } }
it 'returns issues for each epic' do
......
......@@ -75,6 +75,7 @@ RSpec.describe 'Epics through GroupQuery' do
context 'with sort and pagination' do
let_it_be(:epic3) { create(:epic, group: group, start_date: 4.days.ago, end_date: 7.days.ago ) }
let_it_be(:epic4) { create(:epic, group: group, start_date: 5.days.ago, end_date: 6.days.ago ) }
let(:current_user) { user }
let(:data_path) { [:group, :epics] }
......@@ -169,6 +170,7 @@ RSpec.describe 'Epics through GroupQuery' do
context 'query performance' do
let_it_be(:child_epic) { create(:epic, group: group, parent: create(:epic, group: group)) }
let(:epic_node) do
<<~NODE
edges {
......
......@@ -4,6 +4,7 @@ require 'spec_helper'
RSpec.describe Mutations::Boards::Create do
let_it_be(:parent) { create(:group) }
let(:group_path) { parent.full_path }
let(:params) do
{
......
......@@ -7,6 +7,7 @@ RSpec.describe Mutations::Boards::EpicBoards::Create do
let_it_be(:current_user) { create(:user) }
let_it_be(:group) { create(:group) }
let(:name) { 'board name' }
let(:mutation) { graphql_mutation(:epic_board_create, params) }
let(:label) { create(:group_label, group: group) }
......
......@@ -8,6 +8,7 @@ RSpec.describe Mutations::Boards::EpicBoards::Update do
let_it_be(:current_user) { create(:user) }
let_it_be(:group) { create(:group) }
let_it_be_with_reload(:board) { create(:epic_board, group: group, name: 'orig name') }
let(:name) { 'board name' }
let(:mutation) { graphql_mutation(:epic_board_update, params) }
let(:label) { create(:group_label, group: group) }
......
......@@ -55,6 +55,7 @@ RSpec.describe 'Reposition and move issue within board lists' do
context 'when user sets nil epic' do
let_it_be(:epic_issue) { create(:epic_issue, issue: issue1, epic: epic) }
let(:issue_move_params) do
{
epic_id: nil,
......
......@@ -10,6 +10,7 @@ RSpec.describe 'Update list limit metrics' do
let_it_be(:user) { create(:user) }
let_it_be(:list) { create(:list, board: board) }
let_it_be(:forbidden_user) { create(:user) }
let(:current_user) { user }
let(:mutation_class) { Mutations::Boards::Lists::UpdateLimitMetrics }
......
......@@ -6,6 +6,7 @@ RSpec.describe 'Delete a compliance framework' do
include GraphqlHelpers
let_it_be(:framework) { create(:compliance_framework) }
let(:mutation) { graphql_mutation(:destroy_compliance_framework, { id: global_id_of(framework) }) }
subject { post_graphql_mutation(mutation, current_user: current_user) }
......
......@@ -6,6 +6,7 @@ RSpec.describe 'Update a compliance framework' do
include GraphqlHelpers
let_it_be(:framework) { create(:compliance_framework) }
let(:mutation) { graphql_mutation(:update_compliance_framework, { id: global_id_of(framework), **params }) }
let(:current_user) { framework.namespace.owner }
let(:params) do
......
......@@ -9,6 +9,7 @@ RSpec.describe 'Update a DAST Scanner Profile' do
let!(:dast_scanner_profile_1) { create(:dast_scanner_profile, project: project) }
let_it_be(:new_profile_name) { SecureRandom.hex }
let(:new_target_timeout) { dast_scanner_profile.target_timeout + 1 }
let(:new_spider_timeout) { dast_scanner_profile.spider_timeout + 1 }
let(:new_scan_type) { (DastScannerProfile.scan_types.keys - [DastScannerProfile.last.scan_type]).first }
......
......@@ -13,6 +13,7 @@ RSpec.describe 'Update Environment Canary Ingress', :clean_gitlab_redis_cache do
let_it_be(:deployment) { create(:deployment, :success, environment: environment, project: project) }
let_it_be(:maintainer) { create(:user) }
let_it_be(:developer) { create(:user) }
let(:environment_id) { environment.to_global_id.to_s }
let(:weight) { 25 }
let(:actor) { developer }
......
......@@ -8,6 +8,7 @@ RSpec.describe 'Add an issue to an Epic' do
let_it_be(:current_user) { create(:user) }
let_it_be(:group) { create(:group) }
let_it_be(:project) { create(:project, namespace: group) }
let(:epic) { create(:epic, group: group) }
let(:issue) { create(:issue, project: project) }
......
......@@ -7,6 +7,7 @@ RSpec.describe 'Set an Epic Subscription' do
let_it_be(:current_user) { create(:user) }
let_it_be(:group) { create(:group) }
let(:epic) { create(:epic, group: group) }
let(:subscribed_state) { true }
......
......@@ -7,6 +7,7 @@ RSpec.describe Mutations::Epics::Update do
let_it_be(:current_user) { create(:user) }
let_it_be(:group) { create(:group) }
let(:label_1) { create(:group_label, group: group) }
let(:label_2) { create(:group_label, group: group) }
let(:label_3) { create(:group_label, group: group) }
......
......@@ -7,6 +7,7 @@ RSpec.describe 'Activate a subscription' do
let_it_be(:current_user) { create(:admin) }
let_it_be(:license_key) { build(:gitlab_license).export }
let(:activation_code) { 'activation_code' }
let(:mutation) do
graphql_mutation(:gitlab_subscription_activate, { activation_code: activation_code })
......
......@@ -8,6 +8,7 @@ RSpec.describe 'Creating a new on-call schedule' do
let_it_be(:current_user) { create(:user) }
let_it_be(:project) { create(:project) }
let_it_be(:schedule) { create(:incident_management_oncall_schedule, project: project) }
let(:args) do
{
project_path: project.full_path,
......
......@@ -7,6 +7,7 @@ RSpec.describe 'Creating a new on-call schedule' do
let_it_be(:current_user) { create(:user) }
let_it_be(:project) { create(:project) }
let(:variables) do
{
project_path: project.full_path,
......
......@@ -8,6 +8,7 @@ RSpec.describe 'Removing an on-call schedule' do
let_it_be(:user) { create(:user) }
let_it_be(:project) { create(:project) }
let_it_be(:oncall_schedule) { create(:incident_management_oncall_schedule, project: project) }
let(:variables) { { project_path: project.full_path, iid: oncall_schedule.iid.to_s } }
let(:mutation) do
......
......@@ -8,6 +8,7 @@ RSpec.describe 'Updating an on-call schedule' do
let_it_be(:user) { create(:user) }
let_it_be(:project) { create(:project) }
let_it_be(:oncall_schedule) { create(:incident_management_oncall_schedule, project: project) }
let(:variables) do
{
project_path: project.full_path,
......
......@@ -12,6 +12,7 @@ RSpec.describe 'Setting the epic of an issue' do
let_it_be(:project) { create(:project, group: group) }
let_it_be(:issue) { create(:issue, project: project) }
let_it_be(:user) { create(:user) }
let(:input) { { group_path: new_epic_group&.full_path } }
let(:mutation) do
......
......@@ -6,6 +6,7 @@ RSpec.describe 'Adding a Note to an Epic' do
include GraphqlHelpers
let_it_be(:current_user) { create(:user) }
let(:epic) { create(:epic, group: group) }
let(:mutation) do
variables = {
......
......@@ -8,6 +8,7 @@ RSpec.describe 'Create test case' do
let_it_be_with_refind(:project) { create(:project, :private) }
let_it_be(:current_user) { create(:user) }
let_it_be(:label) { create(:label, project: project) }
let(:variables) { { project_path: project.full_path, title: 'foo', description: 'bar', label_ids: [label.id] } }
let(:mutation) do
......
......@@ -8,6 +8,7 @@ RSpec.describe 'getting a list of compliance frameworks for a root namespace' do
let_it_be(:namespace) { create(:namespace) }
let_it_be(:compliance_framework_1) { create(:compliance_framework, namespace: namespace, name: 'Test1') }
let_it_be(:compliance_framework_2) { create(:compliance_framework, namespace: namespace, name: 'Test2') }
let(:path) { %i[namespace compliance_frameworks nodes] }
let!(:query) do
......
......@@ -8,6 +8,7 @@ RSpec.describe 'parse alert payload fields' do
let_it_be_with_refind(:project) { create(:project) }
let_it_be(:maintainer) { create(:user) }
let_it_be(:developer) { create(:user) }
let(:current_user) { maintainer }
let(:license) { true }
let(:feature_flag) { true }
......
......@@ -65,6 +65,7 @@ RSpec.describe 'getting a requirement list for a project' do
context 'query performance with test reports' do
let_it_be(:test_report) { create(:test_report, requirement: requirement, state: "passed") }
let(:fields) do
<<~QUERY
edges {
......@@ -172,6 +173,7 @@ RSpec.describe 'getting a requirement list for a project' do
context 'for MISSING status' do
let_it_be(:requirement3) { create(:requirement, project: filter_project, author: other_user, title: 'need test report') }
let(:params) { '(lastTestReportState: MISSING)' }
it 'returns filtered requirements' do
......
......@@ -8,6 +8,7 @@ RSpec.describe 'getting compliance frameworks for a collection of projects' do
let_it_be(:current_user) { create(:user) }
let_it_be(:project_members) { create_list(:project_member, 2, :maintainer, user: current_user) }
let_it_be(:project_ids) { project_members.map { |p| global_id_of(p.source) } }
let(:query) do
graphql_query_for(
:projects, { ids: project_ids }, "nodes { #{query_nodes(:compliance_frameworks)} }"
......@@ -43,6 +44,7 @@ RSpec.describe 'getting compliance frameworks for a collection of projects' do
context 'projects can have a compliance framework' do
let_it_be(:compliance_projects) { create_list(:project, 2, :with_compliance_framework) }
let_it_be(:non_compliance_project) { create(:project) }
let(:projects) { compliance_projects + [non_compliance_project] }
let(:project_ids) { projects.map { |p| global_id_of(p) } }
......@@ -70,6 +72,7 @@ RSpec.describe 'getting compliance frameworks for a collection of projects' do
let_it_be(:framework) { create(:compliance_framework) }
let_it_be(:project_1) { create(:project, compliance_framework_setting: create(:compliance_framework_project_setting, compliance_management_framework: framework )) }
let_it_be(:project_2) { create(:project, compliance_framework_setting: create(:compliance_framework_project_setting, compliance_management_framework: framework )) }
let(:projects) { [project_1, project_2] }
let(:project_ids) { projects.map { |p| global_id_of(p) } }
let(:query) do
......
......@@ -10,11 +10,13 @@ RSpec.describe API::Internal::Base do
let_it_be(:primary_node, reload: true) { create(:geo_node, :primary, url: primary_url) }
let_it_be(:secondary_node, reload: true) { create(:geo_node, url: secondary_url) }
let_it_be(:user) { create(:user) }
let(:secret_token) { Gitlab::Shell.secret_token }
describe 'POST /internal/post_receive', :geo do
let(:key) { create(:key, user: user) }
let_it_be(:project, reload: true) { create(:project, :repository, :wiki_repo) }
let(:gl_repository) { "project-#{project.id}" }
let(:reference_counter) { double('ReferenceCounter') }
......@@ -197,6 +199,7 @@ RSpec.describe API::Internal::Base do
context 'ip restriction' do
let_it_be(:group) { create(:group)}
let_it_be(:project) { create(:project, :repository, namespace: group) }
let(:params) do
{
key_id: key.id,
......@@ -310,6 +313,7 @@ RSpec.describe API::Internal::Base do
describe 'POST /internal/personal_access_token' do
let_it_be(:key) { create(:key, user: user) }
let(:instance_level_max_personal_access_token_lifetime) { nil }
before do
......@@ -361,6 +365,7 @@ RSpec.describe API::Internal::Base do
describe 'POST /internal/two_factor_otp_check' do
let_it_be(:key) { create(:key, user: user) }
let(:key_id) { key.id }
let(:otp) { '123456'}
......
......@@ -673,6 +673,7 @@ RSpec.describe API::Issues, :mailer do
end
let_it_be(:issue) { create(:incident, project: project) }
let!(:image) { create(:issuable_metric_image, issue: issue) }
subject { get api("/projects/#{project.id}/issues/#{issue.iid}/metric_images", user2) }
......
......@@ -8,6 +8,7 @@ RSpec.describe API::Ldap do
let_it_be(:user) { create(:user) }
let_it_be(:admin) { create(:admin) }
let(:adapter) { ldap_adapter }
before do
......
......@@ -6,6 +6,7 @@ RSpec.describe API::MergeRequestApprovalRules do
let_it_be(:user) { create(:user) }
let_it_be(:other_user) { create(:user) }
let_it_be(:project) { create(:project, :public, :repository, creator: user, namespace: user.namespace) }
let(:merge_request) { create(:merge_request, author: user, source_project: project, target_project: project) }
shared_examples_for 'a protected API endpoint for merge request approval rule action' do
......
......@@ -9,6 +9,7 @@ RSpec.describe API::MergeRequestApprovals do
let_it_be(:project, reload: true) { create(:project, :public, :repository, creator: user, namespace: user.namespace, only_allow_merge_if_pipeline_succeeds: false) }
let_it_be(:approver) { create :user }
let_it_be(:group) { create :group }
let(:merge_request) { create(:merge_request, :simple, author: user, assignees: [user], source_project: project, target_project: project, title: "Test", created_at: Time.now) }
shared_examples_for 'an API endpoint for getting merge request approval state' do
......
......@@ -12,6 +12,7 @@ RSpec.describe API::MergeRequests do
let_it_be(:milestone1) { create(:milestone, title: '0.9', project: project) }
let_it_be(:label) { create(:label, title: 'label', color: '#FFAABB', project: project) }
let_it_be(:label2) { create(:label, title: 'a-test', color: '#FFFFFF', project: project) }
let(:base_time) { Time.now }
let!(:merge_request) { create(:merge_request, :simple, milestone: milestone1, author: user, assignees: [user, user2], source_project: project, target_project: project, title: "Test", created_at: base_time) }
......
......@@ -5,6 +5,7 @@ RSpec.describe API::MergeTrains do
let_it_be(:project) { create(:project, :repository) }
let_it_be(:developer) { create(:user) }
let_it_be(:guest) { create(:user) }
let(:user) { developer }
before_all do
......
......@@ -13,6 +13,7 @@ RSpec.describe API::ProjectApprovalRules do
describe 'GET /projects/:id/approval_rules/:approval_rule_id' do
let_it_be(:private_project) { create(:project, :private, creator: user, namespace: user.namespace) }
let!(:approval_rule) { create(:approval_project_rule, project: private_project) }
let(:url) { "/projects/#{private_project.id}/approval_rules/#{approval_rule.id}" }
......@@ -118,6 +119,7 @@ RSpec.describe API::ProjectApprovalRules do
context 'when project is archived' do
let_it_be(:archived_project) { create(:project, :archived, creator: user) }
let(:url) { "/projects/#{archived_project.id}/approval_rules" }
context 'when user has normal permissions' do
......
......@@ -119,6 +119,7 @@ RSpec.describe API::ProjectApprovalSettings do
context 'when project is archived' do
let_it_be(:archived_project) { create(:project, :archived, creator: user) }
let(:url) { "/projects/#{archived_project.id}/approval_settings" }
context 'when user has normal permissions' do
......
......@@ -7,6 +7,7 @@ RSpec.describe API::Projects do
let(:user) { create(:user) }
let_it_be(:another_user) { create(:user) }
let(:project) { create(:project, namespace: user.namespace) }
shared_examples 'inaccessable by reporter role and lower' do
......@@ -603,6 +604,7 @@ RSpec.describe API::Projects do
describe 'GET projects/:id/audit_events' do
let_it_be(:user) { create(:user) }
let_it_be(:project) { create(:project, :public, namespace: user.namespace) }
let(:path) { "/projects/#{project.id}/audit_events" }
it_behaves_like 'inaccessable by reporter role and lower'
......
......@@ -5,6 +5,7 @@ require 'spec_helper'
RSpec.describe API::Todos do
let_it_be(:group) { create(:group) }
let_it_be(:project) { create(:project, group: group) }
let(:user) { create(:user) }
let(:epic) { create(:epic, group: group) }
......
......@@ -10,6 +10,7 @@ RSpec.describe API::Vulnerabilities do
end
let_it_be(:user) { create(:user) }
let(:project_vulnerabilities_path) { "/projects/#{project.id}/vulnerabilities" }
describe 'GET /projects/:id/vulnerabilities' do
......@@ -62,6 +63,7 @@ RSpec.describe API::Vulnerabilities do
let_it_be(:project) { create(:project, :with_vulnerabilities) }
let_it_be(:vulnerability) { project.vulnerabilities.first }
let_it_be(:finding) { create(:vulnerabilities_finding, vulnerability: vulnerability) }
let(:vulnerability_id) { vulnerability.id }
subject(:get_vulnerability) { get api("/vulnerabilities/#{vulnerability_id}", user) }
......@@ -106,6 +108,7 @@ RSpec.describe API::Vulnerabilities do
describe 'POST /projects/:id/vulnerabilities' do
let_it_be(:project) { create(:project) }
let(:finding) { create(:vulnerabilities_finding, project: project) }
let(:finding_id) { finding.id }
let(:expected_error_messages) { { 'base' => ['finding is not found or is already attached to a vulnerability'] } }
......@@ -181,6 +184,7 @@ RSpec.describe API::Vulnerabilities do
end
let_it_be(:project) { create(:project, :with_vulnerabilities) }
let(:vulnerability) { project.vulnerabilities.first }
let(:vulnerability_id) { vulnerability.id }
......@@ -268,6 +272,7 @@ RSpec.describe API::Vulnerabilities do
end
let_it_be(:project) { create(:project, :with_vulnerabilities) }
let(:vulnerability) { project.vulnerabilities.first }
let(:vulnerability_id) { vulnerability.id }
......@@ -325,6 +330,7 @@ RSpec.describe API::Vulnerabilities do
end
let_it_be(:project) { create(:project, :with_vulnerabilities) }
let(:vulnerability) { project.vulnerabilities.first }
let(:vulnerability_id) { vulnerability.id }
......
......@@ -15,6 +15,7 @@ RSpec.describe API::VulnerabilityIssueLinks do
describe 'GET /vulnerabilities/:id/issue_links' do
let_it_be(:vulnerability) { create(:vulnerability, :with_issue_links, project: project) }
let_it_be(:vulnerability_id) { vulnerability.id }
let(:vulnerability_issue_links_path) { "/vulnerabilities/#{vulnerability_id}/issue_links" }
subject(:get_issue_links) { get api(vulnerability_issue_links_path, user) }
......@@ -92,6 +93,7 @@ RSpec.describe API::VulnerabilityIssueLinks do
describe 'POST /vulnerabilities/:id/issue_links' do
let_it_be(:issue) { create(:issue, project: project) }
let_it_be(:vulnerability) { create(:vulnerability, project: project) }
let(:vulnerability_id) { vulnerability.id }
let(:target_issue_iid) { issue.iid }
let(:params) { { target_issue_iid: target_issue_iid } }
......
......@@ -7,6 +7,7 @@ RSpec.describe 'callout alerts' do
describe 'new_user_signups_cap_reached' do
let_it_be(:user) { create(:admin) }
let(:billable_users) { [double(:billable_user)] }
let(:help_page_href) { help_page_path('user/admin_area/settings/sign_up_restrictions.md') }
let(:expected_content) { 'Your instance has reached its user cap' }
......
......@@ -141,6 +141,7 @@ RSpec.describe "Git HTTP requests (Geo)", :geo do
context 'but has not successfully synced' do
let_it_be(:project_with_repo_but_not_synced) { create(:project, :repository, :private) }
let_it_be(:project) { project_with_repo_but_not_synced }
let(:redirect_url) { "#{primary_url}/#{project_with_repo_but_not_synced.full_path}.git/info/refs?service=git-upload-pack" }
before do
......@@ -177,6 +178,7 @@ RSpec.describe "Git HTTP requests (Geo)", :geo do
context 'when the repository does not exist' do
let_it_be(:project) { project_no_repo }
let(:redirect_url) { "#{primary_url}/#{project.full_path}.git/info/refs?service=git-upload-pack" }
it_behaves_like 'a Geo 302 redirect to Primary'
......@@ -222,6 +224,7 @@ RSpec.describe "Git HTTP requests (Geo)", :geo do
end
let_it_be(:project) { project_with_repo }
let(:endpoint_path) { "/#{project.full_path}.git/info/refs" }
let(:redirect_url) { "#{redirected_primary_url}?service=git-receive-pack" }
......@@ -257,6 +260,7 @@ RSpec.describe "Git HTTP requests (Geo)", :geo do
context 'when the repository does not exist' do
let_it_be(:project) { project_no_repo }
let(:redirect_url) { "#{primary_url}/#{project.full_path}.git/git-upload-pack" }
it_behaves_like 'a Geo 302 redirect to Primary'
......@@ -280,6 +284,7 @@ RSpec.describe "Git HTTP requests (Geo)", :geo do
let(:args) { {} }
let_it_be(:project) { project_with_repo }
let(:endpoint_path) { "/#{project.full_path}.git/info/lfs/objects/batch" }
subject do
......@@ -353,6 +358,7 @@ RSpec.describe "Git HTTP requests (Geo)", :geo do
context 'when the repository does not exist' do
let_it_be(:project) { project_no_repo }
let(:redirect_url) { redirected_primary_url }
it_behaves_like 'a Geo 302 redirect to Primary'
......@@ -412,6 +418,7 @@ RSpec.describe "Git HTTP requests (Geo)", :geo do
context 'when the repository does not exist' do
let_it_be(:project) { project_no_repo }
let(:redirect_url) { redirected_primary_url }
it_behaves_like 'a Geo 302 redirect to Primary'
......@@ -433,6 +440,7 @@ RSpec.describe "Git HTTP requests (Geo)", :geo do
end
let_it_be(:project) { project_with_repo }
let(:endpoint_path) { "/#{project.full_path}.git/#{path}" }
let(:redirect_url) { redirected_primary_url }
......@@ -472,6 +480,7 @@ RSpec.describe "Git HTTP requests (Geo)", :geo do
let(:identifier) { "user-#{user.id}" }
let_it_be(:project) { project_with_repo }
let(:gl_repository) { "project-#{project.id}" }
let(:endpoint_path) { "#{::Gitlab::Geo::GitPushHttp::PATH_PREFIX}/#{secondary.id}/#{project.full_path}.git/git-receive-pack" }
......@@ -505,6 +514,7 @@ RSpec.describe "Git HTTP requests (Geo)", :geo do
end
let_it_be(:project) { project_with_repo }
let(:endpoint_path) { "/#{project.full_path}.git/git-receive-pack" }
context 'when gl_id is provided in JWT token' do
......@@ -638,6 +648,7 @@ RSpec.describe "Git HTTP requests (Geo)", :geo do
end
let_it_be(:project) { project_with_repo }
let(:repository_path) { project.full_path }
it 'returns unauthorized error' do
......
......@@ -8,6 +8,7 @@ RSpec.describe Repositories::GitHttpController, type: :request do
let_it_be(:user) { create(:user) }
let_it_be(:project) { create(:project, :repository, :private) }
let(:env) { { user: user.username, password: user.password } }
let(:path) { "#{project.full_path}.git" }
......@@ -136,6 +137,7 @@ RSpec.describe Repositories::GitHttpController, type: :request do
let_it_be(:group) { create(:group, :wiki_repo) }
let_it_be(:user) { create(:user) }
let(:path) { "#{group.wiki.full_path}.git" }
before_all do
......
......@@ -7,6 +7,7 @@ RSpec.describe AlertManagement::ExtractAlertPayloadFieldsService do
let_it_be(:user_with_permissions) { create(:user) }
let_it_be(:user_without_permissions) { create(:user) }
let_it_be(:user) { user_with_permissions }
let(:payload) { { foo: 'bar' } }
let(:payload_json) { Gitlab::Json.generate(payload) }
let(:params) { { payload: payload_json } }
......
......@@ -31,6 +31,7 @@ RSpec.describe AlertManagement::ProcessPrometheusAlertService do
let_it_be(:schedule) { create(:incident_management_oncall_schedule, project: project) }
let_it_be(:rotation) { create(:incident_management_oncall_rotation, schedule: schedule) }
let_it_be(:participant) { create(:incident_management_oncall_participant, :with_developer_access, rotation: rotation) }
let(:users) { [participant.user] }
before do
......
......@@ -230,6 +230,7 @@ RSpec.describe ApprovalRules::CreateService do
context 'when project rule id is present' do
let_it_be(:project_user) { create(:user) }
let_it_be(:public_group) { create(:group, :public) }
let(:project_user_approvers) { [project_user] }
let(:group_user_approvers) { [public_group] }
let(:merge_request_approvers) { {} }
......
......@@ -6,6 +6,7 @@ RSpec.describe AuditEventService do
let(:project) { build_stubbed(:project) }
let_it_be(:user) { create(:user, current_sign_in_ip: '192.168.68.104') }
let_it_be(:project_member) { create(:project_member, user: user, expires_at: 1.day.from_now) }
let(:request_ip_address) { '127.0.0.1' }
let(:details) { { action: :destroy, ip_address: request_ip_address } }
......@@ -453,6 +454,7 @@ RSpec.describe AuditEventService do
describe '#for_project' do
let_it_be(:current_user) { create(:user, name: 'Test User') }
let_it_be(:project) { create(:project) }
let(:action) { :destroy }
let(:options) { { action: action } }
......@@ -476,6 +478,7 @@ RSpec.describe AuditEventService do
describe '#for_group' do
let_it_be(:user) { create(:user, name: 'Test User') }
let_it_be(:group) { create(:group) }
let(:action) { :destroy }
let(:options) { { action: action } }
let(:service) { described_class.new(user, group, options).for_group }
......
......@@ -6,6 +6,7 @@ RSpec.describe BillableMembers::DestroyService do
describe '#execute' do
let_it_be(:current_user) { create(:user) }
let_it_be(:root_group) { create(:group) }
let(:group) { root_group }
let(:user_id) { nil }
......
......@@ -4,6 +4,7 @@ require 'spec_helper'
RSpec.describe Boards::EpicBoards::DestroyService do
let_it_be(:parent) { create(:group) }
let(:boards) { parent.epic_boards }
let(:board_factory) { :epic_board }
......
......@@ -6,6 +6,7 @@ RSpec.describe Clusters::AgentTokens::CreateService do
subject(:service) { described_class.new(container: project, current_user: user, params: params) }
let_it_be(:user) { create(:user) }
let(:cluster_agent) { create(:cluster_agent) }
let(:project) { cluster_agent.project }
let(:params) { { agent_id: cluster_agent.id, description: 'token description', name: 'token name' } }
......
......@@ -4,6 +4,7 @@ require 'spec_helper'
RSpec.describe ComplianceManagement::Frameworks::CreateService do
let_it_be_with_refind(:namespace) { create(:namespace) }
let(:params) do
{
name: 'GDPR',
......@@ -36,6 +37,7 @@ RSpec.describe ComplianceManagement::Frameworks::CreateService do
context 'namespace has a parent' do
let_it_be(:user) { create(:user) }
let_it_be_with_reload(:group) { create(:group, :with_hierarchy) }
let(:descendant) { group.descendants.first }
before do
......
......@@ -5,6 +5,7 @@ require 'spec_helper'
RSpec.describe ComplianceManagement::Frameworks::UpdateService do
let_it_be_with_refind(:namespace) { create(:namespace) }
let_it_be_with_refind(:framework) { create(:compliance_framework, namespace: namespace) }
let(:current_user) { namespace.owner }
let(:params) { { color: '#000001', description: 'New Description', name: 'New Name' } }
......
......@@ -5,6 +5,7 @@ require 'spec_helper'
RSpec.describe ExternalStatusChecks::CreateService do
let_it_be(:project) { create(:project) }
let_it_be(:protected_branch) { create(:protected_branch, project: project) }
let(:user) { project.owner }
let(:params) do
{
......
......@@ -5,6 +5,7 @@ require 'spec_helper'
RSpec.describe ExternalStatusChecks::DestroyService do
let_it_be(:project) { create(:project) }
let_it_be(:rule) { create(:external_status_check, project: project) }
let(:current_user) { project.owner }
subject { described_class.new(container: project, current_user: current_user).execute(rule) }
......
......@@ -6,6 +6,7 @@ RSpec.describe ExternalStatusChecks::UpdateService do
let_it_be(:project) { create(:project) }
let_it_be(:check) { create(:external_status_check, project: project) }
let_it_be(:protected_branch) { create(:protected_branch, project: project) }
let(:current_user) { project.owner }
let(:params) { { id: project.id, check_id: check.id, external_url: 'http://newvalue.com', name: 'new name', protected_branch_ids: [protected_branch.id] } }
......
......@@ -11,6 +11,7 @@ RSpec.describe GitlabSubscriptions::ActivateService do
end
let_it_be(:license_key) { build(:gitlab_license).export }
let(:cloud_license_enabled) { true }
let(:activation_code) { 'activation_code' }
......
......@@ -6,6 +6,7 @@ RSpec.describe GitlabSubscriptions::ApplyTrialService do
subject(:execute) { described_class.new.execute(apply_trial_params) }
let_it_be(:namespace) { create(:namespace) }
let(:apply_trial_params) do
{
trial_user: {
......
......@@ -8,6 +8,7 @@ RSpec.describe IncidentManagement::Incidents::UploadMetricService do
let_it_be_with_refind(:project) { create(:project) }
let_it_be_with_refind(:issuable) { create(:incident, project: project) }
let_it_be_with_refind(:current_user) { create(:user) }
let(:params) do
{
file: fixture_file_upload('spec/fixtures/rails_sample.jpg', 'image/jpg'),
......
......@@ -9,6 +9,7 @@ RSpec.describe IncidentManagement::OncallRotations::EditService do
let_it_be_with_refind(:oncall_schedule) { create(:incident_management_oncall_schedule, :utc, project: project) }
let_it_be_with_refind(:oncall_rotation) { create(:incident_management_oncall_rotation, :with_participants, schedule: oncall_schedule, participants_count: 2) }
let(:current_user) { user_with_permissions }
let(:params) { rotation_params }
let(:service) { described_class.new(oncall_rotation, current_user, params) }
......
......@@ -5,6 +5,7 @@ require 'spec_helper'
RSpec.describe MergeRequestApprovalSettings::UpdateService do
let_it_be_with_reload(:group) { create(:group) }
let_it_be(:user) { create(:user) }
let(:params) { { allow_author_approval: true } }
subject(:service) do
......
......@@ -5,6 +5,7 @@ require 'spec_helper'
RSpec.describe PersonalAccessTokens::CreateService do
describe '#execute' do
let_it_be(:user) { create(:user) }
let(:params) { { name: 'admin-token', impersonation: true, scopes: [:api], expires_at: Date.today + 1.month } }
context 'when non-admin user' do
......
......@@ -7,6 +7,7 @@ RSpec.describe PersonalAccessTokens::Groups::UpdateLifetimeService do
describe '#execute', :clean_gitlab_redis_shared_state do
let_it_be(:group) { create(:group_with_managed_accounts)}
subject { described_class.new(group) }
let(:lease_key) { "personal_access_tokens/groups/update_lifetime_service:group_id:#{group.id}" }
......
......@@ -5,6 +5,7 @@ require 'spec_helper'
RSpec.describe PushRules::CreateOrUpdateService, '#execute' do
let_it_be_with_reload(:project) { create(:project) }
let_it_be(:user) { create(:user) }
let(:params) { { max_file_size: 28 } }
subject { described_class.new(container: project, current_user: user, params: params) }
......
......@@ -7,6 +7,7 @@ RSpec.describe QualityManagement::TestCases::CreateService do
let_it_be_with_refind(:project) { create(:project, :empty_repo) }
let(:description) { 'test case description' }
let_it_be(:label) { create(:label, project: project) }
let(:service) { described_class.new(project, user, title: title, description: description, label_ids: [label.id]) }
describe '#execute' do
......
......@@ -12,6 +12,7 @@ RSpec.describe QuickActions::InterpretService do
let_it_be_with_refind(:group) { create(:group) }
let_it_be_with_refind(:project) { create(:project, :repository, :public, group: group) }
let_it_be_with_reload(:issue) { create(:issue, project: project) }
let(:service) { described_class.new(project, current_user) }
before do
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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