Commit cac0d9b8 authored by Doug Stull's avatar Doug Stull

Resolve RSpec/EmptyLineAfterLetBlock Exceptions in Main area

- comply to style guide.
parent 1d704420
This diff is collapsed.
......@@ -18,6 +18,7 @@ RSpec.describe ObjectStoreSettings do
'region' => 'us-east-1'
}
end
let(:config) do
{
'lfs' => { 'enabled' => true },
......
......@@ -265,6 +265,7 @@ RSpec.describe Boards::IssuesController do
hash[:ids] = [issue2.id]
end
end
let(:requesting_user) { user }
let(:expected_status) { 200 }
let(:expected_issue_count) { 2 }
......@@ -280,6 +281,7 @@ RSpec.describe Boards::IssuesController do
hash[:ids] = [issue2.id]
end
end
let(:requesting_user) { user }
let(:expected_status) { 403 }
let(:expected_issue_count) { 1 }
......@@ -296,6 +298,7 @@ RSpec.describe Boards::IssuesController do
hash[:move_before_id] = nil
end
end
let(:requesting_user) { user }
let(:expected_status) { 200 }
let(:expected_issue_count) { 4 }
......@@ -317,6 +320,7 @@ RSpec.describe Boards::IssuesController do
hash[:move_before_id] = nil
end
end
let(:requesting_user) { user }
let(:expected_status) { 200 }
let(:expected_issue_count) { 3 }
......@@ -332,6 +336,7 @@ RSpec.describe Boards::IssuesController do
hash[:move_before_id] = nil
end
end
let(:requesting_user) { user }
let(:expected_status) { 200 }
let(:expected_issue_count) { 4 }
......@@ -350,6 +355,7 @@ RSpec.describe Boards::IssuesController do
hash[:move_after_id] = issue4.id
end
end
let(:requesting_user) { user }
let(:expected_status) { 200 }
let(:expected_issue_count) { 5 }
......@@ -365,6 +371,7 @@ RSpec.describe Boards::IssuesController do
hash[:ids] = (0..51).to_a
end
end
let(:requesting_user) { user }
let(:expected_status) { 422 }
let(:expected_issue_count) { 1 }
......@@ -380,6 +387,7 @@ RSpec.describe Boards::IssuesController do
hash[:ids] = 'foobar'
end
end
let(:requesting_user) { user }
let(:expected_status) { 400 }
let(:expected_issue_count) { 1 }
......
......@@ -86,6 +86,7 @@ RSpec.describe Groups::MilestonesController do
let!(:public_project_with_private_issues_and_mrs) do
create(:project, :public, :issues_private, :merge_requests_private, group: public_group)
end
let!(:private_milestone) { create(:milestone, project: public_project_with_private_issues_and_mrs, title: 'project milestone') }
context 'when anonymous user' do
......
......@@ -36,6 +36,7 @@ RSpec.describe Groups::Settings::RepositoryController do
deploy_token_type: DeployToken.deploy_token_types[:group_type]
}
end
let(:request_params) do
{
group_id: group.to_param,
......
......@@ -53,6 +53,7 @@ RSpec.describe Import::GitlabController do
let(:gitlab_user) do
{ username: gitlab_username }.with_indifferent_access
end
let(:gitlab_repo) do
{
path: 'vim',
......
......@@ -245,6 +245,7 @@ RSpec.describe Projects::ForksController do
continue: continue_params
}
end
let(:continue_params) do
{
to: '/-/ide/project/path',
......
......@@ -59,6 +59,7 @@ RSpec.describe Projects::LogsController do
container_name: container
}
end
let(:service_result_json) { Gitlab::Json.parse(service_result.to_json) }
let_it_be(:cluster) { create(:cluster, :provided_by_gcp, environment_scope: '*', projects: [project]) }
......
......@@ -302,6 +302,7 @@ RSpec.describe Projects::NotesController do
target_id: merge_request.id
}.merge(extra_request_params)
end
let(:extra_request_params) { {} }
let(:project_visibility) { Gitlab::VisibilityLevel::PUBLIC }
......
......@@ -27,6 +27,7 @@ RSpec.describe Projects::ProtectedBranchesController do
{ merge_access_levels_attributes: maintainer_access_level,
push_access_levels_attributes: maintainer_access_level }
end
let(:create_params) { attributes_for(:protected_branch).merge(access_level_params) }
before do
......
......@@ -18,6 +18,7 @@ RSpec.describe Projects::Serverless::FunctionsController do
let(:knative_stub_options) do
{ namespace: namespace.namespace, name: function_name, description: function_description }
end
let(:knative) { create(:clusters_applications_knative, :installed, cluster: cluster) }
let(:namespace) do
......
......@@ -56,6 +56,7 @@ RSpec.describe Projects::Settings::RepositoryController do
deploy_token_type: DeployToken.deploy_token_types[:project_type]
}
end
let(:request_params) do
{
namespace_id: project.namespace.to_param,
......
......@@ -47,6 +47,7 @@ RSpec.describe Projects::VariablesController do
protected: variable.protected?.to_s,
environment_scope: variable.environment_scope }
end
let(:new_variable_attributes) do
{ key: 'new_key',
secret_value: 'dummy_value',
......
......@@ -17,6 +17,7 @@ RSpec.describe Repositories::GitHttpController do
repository_id: repository_id
}
end
let(:params) { container_params }
describe 'HEAD #info_refs' do
......
......@@ -216,6 +216,7 @@ RSpec.describe SentNotificationsController do
merge_request.subscriptions.create(user: user, project: project, subscribed: true)
end
end
let(:sent_notification) { create(:sent_notification, project: project, noteable: merge_request, recipient: user) }
before do
......
......@@ -196,6 +196,7 @@ RSpec.describe 'Admin Mode Login', :clean_gitlab_redis_shared_state, :do_not_moc
'base' => 'dc=example,dc=com'
}
end
let(:user) { create(:omniauth_user, :admin, :two_factor, extern_uid: uid, provider: provider) }
before do
......
......@@ -30,6 +30,7 @@ RSpec.describe "User Feed" do
author: user,
description: "Houston, we have a bug!\n\n***\n\nI guess.")
end
let(:note) do
create(:note,
noteable: issue,
......@@ -37,6 +38,7 @@ RSpec.describe "User Feed" do
note: 'Bug confirmed :+1:',
project: project)
end
let(:merge_request) do
create(:merge_request,
title: 'Fix bug',
......@@ -45,6 +47,7 @@ RSpec.describe "User Feed" do
target_project: project,
description: "Here is the fix: ![an image](image.png)")
end
let(:push_event) { create(:push_event, project: project, author: user) }
let!(:push_event_payload) { create(:push_event_payload, event: push_event) }
......
......@@ -83,6 +83,7 @@ RSpec.describe 'Metrics rendering', :js, :kubeclient, :use_clean_rails_memory_st
y_label: 'Total Cores'
}
end
let(:metrics_url_2) { urls.metrics_project_environment_url(project, environment, **chart_params_2) }
let(:description) { "See [metrics dashboard](#{metrics_url}) for info. \n See [metrics dashboard](#{metrics_url_2}) for info." }
let(:issue) { create(:issue, project: project, description: description) }
......
......@@ -10,6 +10,7 @@ RSpec.describe 'User comments on a diff', :js do
let(:merge_request) do
create(:merge_request_with_diffs, source_project: project, target_project: project, source_branch: 'merge-test')
end
let(:user) { create(:user) }
before do
......
......@@ -15,6 +15,7 @@ RSpec.describe 'Merge request < User customizes merge commit message', :js do
description: "Description\n\nclosing #{issue_1.to_reference}, #{issue_2.to_reference}"
)
end
let(:textbox) { page.find(:css, '#merge-message-edit', visible: false) }
let(:default_message) do
[
......@@ -24,6 +25,7 @@ RSpec.describe 'Merge request < User customizes merge commit message', :js do
"See merge request #{merge_request.to_reference(full: true)}"
].join("\n\n")
end
let(:message_with_description) do
[
"Merge branch 'feature' into 'master'",
......
......@@ -12,6 +12,7 @@ RSpec.describe 'Merge requests > User merges immediately', :js do
head_pipeline: pipeline,
source_branch: pipeline.ref)
end
let(:pipeline) do
create(:ci_pipeline, project: project,
ref: 'master',
......
......@@ -11,6 +11,7 @@ RSpec.describe 'Merge request > User merges when pipeline succeeds', :js do
title: 'Bug NS-04',
merge_params: { force_remove_source_branch: '1' })
end
let(:pipeline) do
create(:ci_pipeline, project: project,
sha: merge_request.diff_head_sha,
......@@ -115,6 +116,7 @@ RSpec.describe 'Merge request > User merges when pipeline succeeds', :js do
merge_user: user,
title: 'MepMep')
end
let!(:build) do
create(:ci_build, pipeline: pipeline)
end
......
......@@ -10,6 +10,7 @@ RSpec.describe 'Merge request > User posts notes', :js do
let(:merge_request) do
create(:merge_request, source_project: project, target_project: project)
end
let!(:note) do
create(:note_on_merge_request, :with_attachment, noteable: merge_request,
project: project)
......
......@@ -11,6 +11,7 @@ RSpec.describe 'Merge request > User resolves Work in Progress', :js do
title: 'WIP: Bug NS-04',
merge_params: { force_remove_source_branch: '1' })
end
let(:pipeline) do
create(:ci_pipeline, project: project,
sha: merge_request.diff_head_sha,
......
......@@ -16,6 +16,7 @@ RSpec.describe 'Merge request > User sees avatars on diff notes', :js do
diff_refs: merge_request.diff_refs
)
end
let!(:note) { create(:diff_note_on_merge_request, project: project, noteable: merge_request, position: position) }
before do
......
......@@ -16,6 +16,7 @@ RSpec.describe 'Merge request > User sees closing issues message', :js do
title: merge_request_title
)
end
let(:merge_request_description) { 'Merge Request Description' }
let(:merge_request_title) { 'Merge Request Title' }
......
......@@ -24,6 +24,7 @@ RSpec.describe 'Merge request > User sees threads', :js do
diff_refs: outdated_diff_refs
)
end
let(:outdated_diff_refs) { project.commit("874797c3a73b60d2187ed6e2fcabd289ff75171e").diff_refs }
before do
......
......@@ -53,6 +53,7 @@ RSpec.describe 'Merge request > User sees pipelines triggered by merge request',
Ci::CreatePipelineService.new(project, user, ref: 'feature')
.execute(:merge_request_event, merge_request: merge_request)
end
let(:enable_mr_tabs_position_flag) { false }
before do
......
......@@ -13,6 +13,7 @@ RSpec.describe 'Merge request > User sees pipelines from forked project', :js do
target_project: target_project,
description: 'Test merge request')
end
let(:pipeline) do
create(:ci_pipeline,
project: forked_project,
......
......@@ -8,6 +8,7 @@ RSpec.describe 'Merge request > User sees versions', :js do
mr.merge_request_diff.destroy
end
end
let(:project) { merge_request.source_project }
let(:user) { project.creator }
let!(:merge_request_diff1) { merge_request.merge_request_diffs.create(head_commit_sha: '6f6d7e7ed97bb5f0054f2b1df789b39ca89b6ff9') }
......
......@@ -22,6 +22,7 @@ RSpec.describe 'User comments on a diff', :js do
let(:merge_request) do
create(:merge_request_with_diffs, source_project: project, target_project: project, source_branch: 'merge-test')
end
let(:user) { create(:user) }
before do
......
......@@ -10,6 +10,7 @@ RSpec.describe 'Merge Request > User tries to access private project information
name: 'nothing to see here',
repository_access_level: ProjectFeature::PRIVATE)
end
let(:owned_project) do
create(:project, :public, :repository,
namespace: current_user.namespace,
......
......@@ -6,6 +6,7 @@ RSpec.describe 'User views diffs file-by-file', :js do
let(:merge_request) do
create(:merge_request_with_diffs, source_project: project, target_project: project, source_branch: 'merge-test')
end
let(:project) { create(:project, :repository) }
let(:user) { create(:user, view_diffs_file_by_file: true) }
......
......@@ -6,6 +6,7 @@ RSpec.describe 'User views diffs', :js do
let(:merge_request) do
create(:merge_request_with_diffs, source_project: project, target_project: project, source_branch: 'merge-test')
end
let(:project) { create(:project, :public, :repository) }
let(:view) { 'inline' }
......
......@@ -6,6 +6,7 @@ RSpec.describe 'User views diff by commit', :js do
let(:merge_request) do
create(:merge_request_with_diffs, source_project: project, target_project: project, source_branch: 'merge-test')
end
let(:project) { create(:project, :public, :repository) }
before do
......
......@@ -14,6 +14,7 @@ RSpec.describe 'Profile > Chat' do
let(:params) do
{ team_id: 'T00', team_domain: 'my_chat_team', user_id: 'U01', user_name: 'my_chat_user' }
end
let!(:authorize_url) { ChatNames::AuthorizeUserService.new(service, params).execute }
let(:authorize_path) { URI.parse(authorize_url).request_uri }
......
......@@ -6,6 +6,7 @@ RSpec.describe 'Classification label on project pages' do
let(:project) do
create(:project, external_authorization_classification_label: 'authorized label')
end
let(:user) { create(:user) }
before do
......
......@@ -12,6 +12,7 @@ RSpec.describe 'Mini Pipeline Graph in Commit View', :js do
ref: project.default_branch,
sha: project.commit.sha)
end
let(:build) { create(:ci_build, pipeline: pipeline) }
it 'display icon with status' do
......
......@@ -9,6 +9,7 @@ RSpec.describe "User browses files" do
"You're not allowed to make changes to this project directly. "\
"A fork of this project has been created that you can make changes in, so you can submit a merge request."
end
let(:project) { create(:project, :repository, name: "Shop") }
let(:project2) { create(:project, :repository, name: "Another Project", path: "another-project") }
let(:tree_path_root_ref) { project_tree_path(project, project.repository.root_ref) }
......
......@@ -7,6 +7,7 @@ RSpec.describe 'Projects > Files > User creates a directory', :js do
"You're not allowed to make changes to this project directly. "\
"A fork of this project has been created that you can make changes in, so you can submit a merge request."
end
let(:project) { create(:project, :repository) }
let(:project2) { create(:project, :repository, name: 'Another Project', path: 'another-project') }
let(:project2_tree_path_root_ref) { project_tree_path(project2, project2.repository.root_ref) }
......
......@@ -7,6 +7,7 @@ RSpec.describe 'Projects > Files > User creates files', :js do
"You're not allowed to make changes to this project directly. "\
"A fork of this project has been created that you can make changes in, so you can submit a merge request."
end
let(:project) { create(:project, :repository, name: 'Shop') }
let(:project2) { create(:project, :repository, name: 'Another Project', path: 'another-project') }
let(:project_tree_path_root_ref) { project_tree_path(project, project.repository.root_ref) }
......
......@@ -7,6 +7,7 @@ RSpec.describe 'Projects > Files > User deletes files', :js do
"You're not allowed to make changes to this project directly. "\
"A fork of this project has been created that you can make changes in, so you can submit a merge request."
end
let(:project) { create(:project, :repository, name: 'Shop') }
let(:project2) { create(:project, :repository, name: 'Another Project', path: 'another-project') }
let(:project_tree_path_root_ref) { project_tree_path(project, project.repository.root_ref) }
......
......@@ -9,6 +9,7 @@ RSpec.describe 'Projects > Files > User replaces files', :js do
"You're not allowed to make changes to this project directly. "\
"A fork of this project has been created that you can make changes in, so you can submit a merge request."
end
let(:project) { create(:project, :repository, name: 'Shop') }
let(:project2) { create(:project, :repository, name: 'Another Project', path: 'another-project') }
let(:project_tree_path_root_ref) { project_tree_path(project, project.repository.root_ref) }
......
......@@ -19,6 +19,7 @@ RSpec.describe 'Import/Export - project export integration test', :js do
key: [Project, Ci::Variable, :yaml_variables]
}
end
let(:safe_hashes) { { yaml_variables: %w[key value public] } }
let(:project) { setup_project }
......
......@@ -11,33 +11,39 @@ RSpec.describe 'viewing an issue with cross project references' do
create(:project, :public,
external_authorization_classification_label: 'other_label')
end
let(:other_issue) do
create(:issue, :closed,
title: 'I am in another project',
project: other_project)
end
let(:other_confidential_issue) do
create(:issue, :confidential, :closed,
title: 'I am in another project and confidential',
project: other_project)
end
let(:other_merge_request) do
create(:merge_request, :closed,
title: 'I am a merge request in another project',
source_project: other_project)
end
let(:description_referencing_other_issue) do
"Referencing: #{other_issue.to_reference(project)}, "\
"a confidential issue #{confidential_issue.to_reference}, "\
"a cross project confidential issue #{other_confidential_issue.to_reference(project)}, and "\
"a cross project merge request #{other_merge_request.to_reference(project)}"
end
let(:project) { create(:project) }
let(:issue) do
create(:issue,
project: project,
description: description_referencing_other_issue )
end
let(:confidential_issue) do
create(:issue, :confidential, :closed,
title: "I am in the same project and confidential",
......
......@@ -137,6 +137,7 @@ RSpec.describe 'Pipeline', :js do
source_project: project,
source_branch: pipeline.ref)
end
let!(:merge_request2) do
create(:merge_request,
source_project: project,
......
......@@ -11,9 +11,11 @@ RSpec.describe 'User views wiki pages' do
let!(:wiki_page1) do
create(:wiki_page, wiki: project.wiki, title: '3 home', content: '3')
end
let!(:wiki_page2) do
create(:wiki_page, wiki: project.wiki, title: '1 home', content: '1')
end
let!(:wiki_page3) do
create(:wiki_page, wiki: project.wiki, title: '2 home', content: '2')
end
......
......@@ -10,15 +10,19 @@ RSpec.describe ForkTargetsFinder do
let!(:maintained_group) do
create(:group).tap { |g| g.add_maintainer(user) }
end
let!(:owned_group) do
create(:group).tap { |g| g.add_owner(user) }
end
let!(:developer_group) do
create(:group).tap { |g| g.add_developer(user) }
end
let!(:reporter_group) do
create(:group).tap { |g| g.add_reporter(user) }
end
let!(:guest_group) do
create(:group).tap { |g| g.add_guest(user) }
end
......
......@@ -38,6 +38,7 @@ RSpec.describe Projects::MergeRequestsController, '(JavaScript fixtures)', type:
sha: merge_request.diff_head_sha
)
end
let(:path) { "files/ruby/popen.rb" }
let(:position) do
build(:text_diff_position, :added,
......
......@@ -257,6 +257,7 @@ RSpec.describe 'Gitlab::Graphql::Authorization' do
type.field :id, GraphQL::ID_TYPE, null: false
end
end
let(:project_type) do |type|
type_factory do |type|
type.graphql_name 'FakeProjectType'
......@@ -264,11 +265,13 @@ RSpec.describe 'Gitlab::Graphql::Authorization' do
resolve: -> (_, _, _) { Issue.where(project: [visible_project, other_project]).order(id: :asc) }
end
end
let(:query_type) do
query_factory do |query|
query.field :test_project, project_type, null: false, resolve: -> (_, _, _) { visible_project }
end
end
let(:query_string) do
<<~QRY
{ testProject { testIssues(first: 3) { edges { node { id } } } } }
......
......@@ -17,6 +17,7 @@ RSpec.describe Mutations::Issues::Update do
discussion_locked: true
}
end
let(:mutation) { described_class.new(object: nil, context: { current_user: user }, field: nil) }
let(:mutated_issue) { subject[:issue] }
......
......@@ -18,6 +18,7 @@ RSpec.describe Resolvers::CommitPipelinesResolver do
status: 'success'
)
end
let!(:pipeline2) do
create(
:ci_pipeline,
......@@ -27,6 +28,7 @@ RSpec.describe Resolvers::CommitPipelinesResolver do
status: 'failed'
)
end
let!(:pipeline3) do
create(
:ci_pipeline,
......
......@@ -10,6 +10,7 @@ RSpec.describe GitlabSchema.types['DesignAtVersion'] do
version = design.versions.first
GitlabSchema.id_from_object(create(:design_at_version, design: design, version: version))
end
let_it_be(:object_id_b) { GitlabSchema.id_from_object(create(:design_at_version)) }
let(:object_type) { ::Types::DesignManagement::DesignAtVersionType }
end
......
......@@ -33,6 +33,7 @@ RSpec.describe GitlabSchema.types['Snippet'] do
}
)
end
let(:response) { subject.dig('data', 'snippets', 'nodes')[0] }
subject { GitlabSchema.execute(query, context: { current_user: current_user }).as_json }
......@@ -97,6 +98,7 @@ RSpec.describe GitlabSchema.types['Snippet'] do
}
)
end
let(:response) { subject.dig('data', 'snippets', 'nodes')[0] }
subject { GitlabSchema.execute(query, context: { current_user: user }).as_json }
......
......@@ -11,6 +11,7 @@ RSpec.describe BlameHelper do
Time.zone.local(2013, 2, 24, 0, 0, 0),
Time.zone.local(2010, 9, 22, 0, 0, 0)]
end
let(:blame_groups) do
[
{ commit: double(committed_date: dates[0]) },
......@@ -57,6 +58,7 @@ RSpec.describe BlameHelper do
project = double(created_at: now)
helper.age_map_duration(today_blame_groups, project)
end
let(:today_blame_groups) { [{ commit: double(committed_date: now) }] }
let(:now) { Time.zone.now }
......
......@@ -114,12 +114,14 @@ RSpec.describe GroupsHelper do
ancestor_locked_and_has_been_overridden: /This setting is applied on .+ and has been overridden on this subgroup/
}
end
let(:possible_linked_ancestors) do
{
root_group: root_group,
subgroup: subgroup
}
end
let(:users) do
{
root_owner: root_owner,
......
......@@ -10,6 +10,7 @@ RSpec.describe NamespacesHelper do
:private,
project_creation_level: admin_project_creation_level)
end
let!(:user) { create(:user) }
let!(:user_project_creation_level) { nil }
let!(:user_group) do
......@@ -17,18 +18,21 @@ RSpec.describe NamespacesHelper do
:private,
project_creation_level: user_project_creation_level)
end
let!(:subgroup1) do
create(:group,
:private,
parent: admin_group,
project_creation_level: nil)
end
let!(:subgroup2) do
create(:group,
:private,
parent: admin_group,
project_creation_level: ::Gitlab::Access::DEVELOPER_MAINTAINER_PROJECT_ACCESS)
end
let!(:subgroup3) do
create(:group,
:private,
......
......@@ -34,6 +34,7 @@ RSpec.describe API::Entities::Nuget::DependencyGroup do
]
}
end
let(:entity) { described_class.new(dependency_group) }
subject { entity.as_json }
......
......@@ -20,6 +20,7 @@ RSpec.describe API::Entities::Nuget::Dependency do
'range': '2.0.0'
}
end
let(:entity) { described_class.new(dependency) }
subject { entity.as_json }
......
......@@ -10,6 +10,7 @@ RSpec.describe API::Entities::Nuget::Metadatum do
icon_url: 'http://sandbox.com/icon'
}
end
let(:expected) do
{
'projectUrl': 'http://sandbox.com/project',
......@@ -17,6 +18,7 @@ RSpec.describe API::Entities::Nuget::Metadatum do
'iconUrl': 'http://sandbox.com/icon'
}
end
let(:entity) { described_class.new(metadatum) }
subject { entity.as_json }
......
......@@ -27,6 +27,7 @@ RSpec.describe API::Entities::Nuget::SearchResult do
}
}
end
let(:expected) do
{
'@type': 'Package',
......
......@@ -12,6 +12,7 @@ RSpec.describe Banzai::Filter::AbsoluteLinkFilter do
let(:only_path_context) do
{ only_path: false }
end
let(:fake_url) { 'http://www.example.com' }
before do
......
......@@ -220,6 +220,7 @@ RSpec.describe Banzai::Filter::MergeRequestReferenceFilter do
let(:reference) do
urls.project_merge_request_url(mr.project, mr) + "/diffs?commit_id=#{mr.diff_head_sha}"
end
let(:commit) { mr.commits.find { |commit| commit.sha == mr.diff_head_sha } }
it 'links to a valid reference' do
......
......@@ -13,6 +13,7 @@ RSpec.describe Banzai::IssuableExtractor do
"<a href='' data-issue='#{issue.id}' data-reference-type='issue' class='gfm'>text</a>"
)
end
let(:merge_request_link) do
html_to_node(
"<a href='' data-merge-request='#{merge_request.id}' data-reference-type='merge_request' class='gfm'>text</a>"
......
......@@ -73,6 +73,7 @@ RSpec.describe Banzai::ObjectRenderer do
end
end
end
let(:cacheless_thing) do
cacheless_class.new.tap do |thing|
thing.title = "Merge branch 'branch-merged' into 'master'"
......
......@@ -109,6 +109,7 @@ RSpec.describe Banzai::Pipeline::FullPipeline do
# Header
MARKDOWN
end
let(:invalid_markdown) do
<<-MARKDOWN.strip_heredoc
test [[_TOC_]]
......
......@@ -14,6 +14,7 @@ RSpec.describe ContainerRegistry::Client do
'User-Agent' => "GitLab/#{Gitlab::VERSION}"
}
end
let(:headers_with_accept_types) do
{
'Accept' => 'application/vnd.docker.distribution.manifest.v2+json, application/vnd.oci.image.manifest.v1+json',
......
......@@ -18,6 +18,7 @@ RSpec.describe Gitlab::AlertManagement::AlertParams do
'some' => { 'extra' => { 'payload' => 'here' } }
}
end
let(:payload) { default_payload }
subject { described_class.from_generic_alert(project: project, payload: payload) }
......@@ -75,6 +76,7 @@ RSpec.describe Gitlab::AlertManagement::AlertParams do
'fingerprint' => 'b6ac4d42057c43c1'
}
end
let(:parsed_alert) { Gitlab::Alerting::Alert.new(project: project, payload: payload) }
subject { described_class.from_prometheus_alert(project: project, parsed_alert: parsed_alert) }
......
......@@ -14,6 +14,7 @@ RSpec.describe Gitlab::ApplicationRateLimiter, :clean_gitlab_redis_cache do
}
}
end
let(:key) { rate_limits.keys[0] }
subject { described_class }
......
......@@ -13,6 +13,7 @@ RSpec.describe Gitlab::Asciidoc::IncludeProcessor do
ref: ref
}
end
let(:ref) { project.repository.root_ref }
let(:max_includes) { 10 }
......
......@@ -473,6 +473,7 @@ module Gitlab
requested_path: requested_path
}
end
let(:commit) { project.commit(ref) }
let(:project) { create(:project, :repository) }
let(:ref) { 'asciidoc' }
......
......@@ -12,6 +12,7 @@ RSpec.describe Gitlab::Auth::AuthFinders do
'rack.input' => ''
}
end
let(:request) { ActionDispatch::Request.new(env) }
def set_param(key, value)
......
......@@ -14,9 +14,11 @@ RSpec.describe Gitlab::Auth::Ldap::User do
nickname: 'john'
}
end
let(:auth_hash) do
OmniAuth::AuthHash.new(uid: 'uid=John Smith,ou=People,dc=example,dc=com', provider: 'ldapmain', info: info)
end
let(:ldap_user_upper_case) { described_class.new(auth_hash_upper_case) }
let(:info_upper_case) do
{
......@@ -25,6 +27,7 @@ RSpec.describe Gitlab::Auth::Ldap::User do
nickname: 'john'
}
end
let(:auth_hash_upper_case) do
OmniAuth::AuthHash.new(uid: 'uid=John Smith,ou=People,dc=example,dc=com', provider: 'ldapmain', info: info_upper_case)
end
......
......@@ -17,6 +17,7 @@ RSpec.describe Gitlab::Auth::OAuth::AuthHash do
let(:uid_raw) do
+"CN=Onur K\xC3\xBC\xC3\xA7\xC3\xBCk,OU=Test,DC=example,DC=net"
end
let(:email_raw) { +"onur.k\xC3\xBC\xC3\xA7\xC3\xBCk_ABC-123@example.net" }
let(:nickname_raw) { +"ok\xC3\xBC\xC3\xA7\xC3\xBCk" }
let(:first_name_raw) { +'Onur' }
......
......@@ -22,6 +22,7 @@ RSpec.describe Gitlab::Auth::OAuth::User do
}
}
end
let(:ldap_user) { Gitlab::Auth::Ldap::Person.new(Net::LDAP::Entry.new, 'ldapmain') }
describe '#persisted?' do
......
......@@ -9,6 +9,7 @@ RSpec.describe Gitlab::Auth::RequestAuthenticator do
'REQUEST_METHOD' => 'GET'
}
end
let(:request) { ActionDispatch::Request.new(env) }
subject { described_class.new(request) }
......
......@@ -19,6 +19,7 @@ RSpec.describe Gitlab::Auth::Saml::User do
email: 'john@mail.com'
}
end
let(:ldap_user) { Gitlab::Auth::Ldap::Person.new(Net::LDAP::Entry.new, 'ldapmain') }
describe '#save' do
......@@ -194,6 +195,7 @@ RSpec.describe Gitlab::Auth::Saml::User do
}
}
end
let(:auth_hash) { OmniAuth::AuthHash.new(auth_hash_base_attributes) }
let(:uid_types) { %w(uid dn email) }
......
......@@ -631,6 +631,7 @@ RSpec.describe Gitlab::Auth, :use_clean_rails_memory_store_caching do
password: password,
password_confirmation: password)
end
let(:username) { 'John' } # username isn't lowercase, test this
let(:password) { 'my-secret' }
......
......@@ -264,6 +264,7 @@ RSpec.describe Gitlab::BackgroundMigration::BackfillSnippetRepositories, :migrat
user_type: user_type,
confirmed_at: 1.day.ago)
end
let!(:invalid_snippet) { snippets.create(id: 4, type: 'PersonalSnippet', author_id: user.id, file_name: '.', content: content) }
let!(:snippet) { snippets.create(id: 5, type: 'PersonalSnippet', author_id: other_user.id, file_name: file_name, content: content) }
let(:ids) { [4, 5] }
......
......@@ -264,6 +264,7 @@ RSpec.describe Gitlab::BackgroundMigration::LegacyUploadMover do
let(:remote_file) do
{ key: "#{legacy_upload.path}" }
end
let(:connection) { ::Fog::Storage.new(FileUploader.object_store_credentials) }
let(:bucket) { connection.directories.create(key: 'uploads') }
......
......@@ -286,9 +286,11 @@ RSpec.describe Gitlab::BackgroundMigration::MigrateIssueTrackersSensitiveData, s
let!(:jira_service_invalid) do
services.create(id: 19, title: 'invalid - title', description: 'invalid - description', type: 'JiraService', properties: 'invalid data', category: 'issue_tracker')
end
let!(:jira_service_valid) do
services.create(id: 20, type: 'JiraService', properties: jira_properties.to_json, category: 'issue_tracker')
end
let!(:bugzilla_service_valid) do
services.create(id: 11, type: 'BugzillaService', title: nil, properties: tracker_properties.to_json, category: 'issue_tracker')
end
......
......@@ -130,6 +130,7 @@ RSpec.describe Gitlab::BackgroundMigration do
let(:retry_queue) do
[double(args: ['Object', [3]], queue: described_class.queue, delete: true)]
end
let(:dead_queue) do
[double(args: ['Object', [4]], queue: described_class.queue, delete: true)]
end
......
......@@ -87,6 +87,7 @@ RSpec.describe Gitlab::BitbucketImport::Importer do
values: sample_issues_statuses
}
end
let(:counter) { double('counter', increment: true) }
subject { described_class.new(project) }
......@@ -109,6 +110,7 @@ RSpec.describe Gitlab::BitbucketImport::Importer do
created_at: Time.now,
updated_at: Time.now)
end
let(:author_line) { "*Created by: someuser*\n\n" }
before do
......
......@@ -213,6 +213,7 @@ RSpec.describe Gitlab::Ci::Ansi2html do
" data-timestamp=\"#{section_start_time.to_i}\" data-section=\"#{class_name(section_name)}\"" \
' role="button"></div>'
end
let(:section_end_html) do
"<div class=\"section-end\" data-section=\"#{class_name(section_name)}\"></div>"
end
......
......@@ -95,6 +95,7 @@ RSpec.describe Gitlab::Ci::Config::Entry::Service do
let(:config) do
{ name: 'postgresql:9.5', alias: 'db', command: %w(cmd run), entrypoint: %w(/bin/sh run), ports: ports }
end
let(:entry) { described_class.new(config, { with_image_ports: image_ports }) }
let(:image_ports) { false }
......
......@@ -92,6 +92,7 @@ RSpec.describe Gitlab::Ci::Config::External::File::Local do
- bundle install --jobs $(nproc) "${FLAGS[@]}"
HEREDOC
end
let(:location) { '/lib/gitlab/ci/templates/existent-file.yml' }
before do
......
......@@ -128,6 +128,7 @@ RSpec.describe Gitlab::Ci::Config::External::Processor do
remote_file
]
end
let(:values) do
{
include: external_files,
......
......@@ -68,6 +68,7 @@ RSpec.describe Gitlab::Ci::Pipeline::Chain::Validate::Repository do
proj.repository.add_tag(user, 'master', 'master')
end
end
let(:command) do
Gitlab::Ci::Pipeline::Chain::Command.new(
project: project, current_user: user, origin_ref: 'master')
......
......@@ -21,6 +21,7 @@ RSpec.describe Gitlab::Ci::Reports::AccessibilityReportsComparer do
}
]
end
let(:different_error) do
[
{
......
......@@ -942,6 +942,7 @@ module Gitlab
let(:variables) do
{ 'VAR1' => 'value1', 'VAR2' => 'value2' }
end
let(:config) do
{
variables: variables,
......@@ -962,9 +963,11 @@ module Gitlab
let(:global_variables) do
{ 'VAR1' => 'global1', 'VAR3' => 'global3', 'VAR4' => 'global4' }
end
let(:job_variables) do
{ 'VAR1' => 'value1', 'VAR2' => 'value2' }
end
let(:config) do
{
before_script: ['pwd'],
......@@ -2075,6 +2078,7 @@ module Gitlab
{ job: "build2" }
]
end
let(:dependencies) { %w(build3) }
it { expect { subject }.to raise_error(Gitlab::Ci::YamlProcessor::ValidationError, 'jobs:test1 dependencies the build3 should be part of needs') }
......
......@@ -11,6 +11,7 @@ RSpec.describe Gitlab::Cleanup::RemoteUploads do
create(:upload, path: 'dir/file2', store: ObjectStorage::Store::LOCAL)
]
end
let(:remote_files) do
[
double(key: 'dir/file1'),
......
......@@ -8,6 +8,7 @@ RSpec.describe Gitlab::CrossProjectAccess::ClassMethods do
extend Gitlab::CrossProjectAccess::ClassMethods
end
end
let(:dummy_proc) { lambda { false } }
describe '#requires_cross_project_access' do
......
......@@ -16,6 +16,7 @@ RSpec.describe Gitlab::Danger::CommitLinter do
let(:commit_class) do
Struct.new(:message, :sha, :diff_parent)
end
let(:commit_message) { 'A commit message' }
let(:commit_sha) { 'abcd1234' }
let(:commit) { commit_class.new(commit_message, commit_sha, diff_parent) }
......
......@@ -22,6 +22,7 @@ RSpec.describe Gitlab::Danger::Roulette do
'tz_offset_hours' => backend_tz_offset_hours
)
end
let(:frontend_reviewer) do
Gitlab::Danger::Teammate.new(
'username' => 'frontend-reviewer',
......@@ -32,6 +33,7 @@ RSpec.describe Gitlab::Danger::Roulette do
'tz_offset_hours' => 2.0
)
end
let(:frontend_maintainer) do
Gitlab::Danger::Teammate.new(
'username' => 'frontend-maintainer',
......@@ -42,6 +44,7 @@ RSpec.describe Gitlab::Danger::Roulette do
'tz_offset_hours' => 2.0
)
end
let(:software_engineer_in_test) do
Gitlab::Danger::Teammate.new(
'username' => 'software-engineer-in-test',
......@@ -52,6 +55,7 @@ RSpec.describe Gitlab::Danger::Roulette do
'tz_offset_hours' => 2.0
)
end
let(:engineering_productivity_reviewer) do
Gitlab::Danger::Teammate.new(
'username' => 'eng-prod-reviewer',
......@@ -296,18 +300,21 @@ RSpec.describe Gitlab::Danger::Roulette do
'tz_offset_hours' => person_tz_offset_hours
)
end
let(:person2) do
Gitlab::Danger::Teammate.new(
'username' => 'user2',
'available' => true,
'tz_offset_hours' => person_tz_offset_hours)
end
let(:author) do
Gitlab::Danger::Teammate.new(
'username' => 'johndoe',
'available' => true,
'tz_offset_hours' => 0.0)
end
let(:unavailable) do
Gitlab::Danger::Teammate.new(
'username' => 'janedoe',
......
......@@ -20,6 +20,7 @@ RSpec.describe Gitlab::Danger::Teammate do
'tz_offset_hours' => tz_offset_hours
}
end
let(:capabilities) { ['reviewer backend'] }
let(:projects) { { project => capabilities } }
let(:role) { 'Engineer, Manage' }
......
......@@ -23,6 +23,7 @@ RSpec.describe Gitlab::Database::Count::TablesampleCountStrategy do
Namespace => threshold + 1
}
end
let(:threshold) { Gitlab::Database::Count::TablesampleCountStrategy::EXACT_COUNT_THRESHOLD }
before do
......
......@@ -32,6 +32,7 @@ RSpec.describe Gitlab::Database::CustomStructure do
Gitlab::Database::PartitioningMigrationHelpers::PartitionedForeignKey.create(
cascade_delete: true, from_table: 'issues', from_column: 'project_id', to_table: 'projects', to_column: 'id')
end
let!(:second_fk) do
Gitlab::Database::PartitioningMigrationHelpers::PartitionedForeignKey.create(
cascade_delete: false, from_table: 'issues', from_column: 'moved_to_id', to_table: 'issues', to_column: 'id')
......
......@@ -8,6 +8,7 @@ RSpec.describe Gitlab::Database::PartitioningMigrationHelpers::ForeignKeyHelpers
let(:model) do
ActiveRecord::Migration.new.extend(described_class)
end
let_it_be(:connection) { ActiveRecord::Base.connection }
let(:referenced_table) { :issues }
let(:function_name) { '_test_partitioned_foreign_keys_function' }
......
......@@ -351,6 +351,7 @@ RSpec.describe Gitlab::Database::PartitioningMigrationHelpers::TableManagementHe
let(:expected_tables) do
%w[000000 201912 202001 202002].map { |suffix| "#{Gitlab::Database::DYNAMIC_PARTITIONS_SCHEMA}.#{partitioned_table}_#{suffix}" }.unshift(partitioned_table)
end
let(:migration_class) { 'Gitlab::Database::PartitioningMigrationHelpers::BackfillPartitionedTable' }
context 'when the table is not allowed' do
......
......@@ -13,6 +13,7 @@ RSpec.describe Gitlab::Database::PostgresqlAdapter::ForceDisconnectableMixin do
end
end
end
let(:config) { Rails.application.config_for(:database).merge(pool: 1) }
let(:pool) { model.establish_connection(config) }
......
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