Commit f47df9c2 authored by Lin Jen-Shin's avatar Lin Jen-Shin

Merge branch 'fix_empty_line_after_final_let_rest' into 'master'

Automatically fixed EmptyLineAfterFinalLet in remaining directories

See merge request gitlab-org/gitlab!21873
parents e3a8a401 33483d1d
...@@ -4,6 +4,7 @@ require 'spec_helper' ...@@ -4,6 +4,7 @@ require 'spec_helper'
describe Mutations::Issues::SetWeight do describe Mutations::Issues::SetWeight do
let(:issue) { create(:issue) } let(:issue) { create(:issue) }
let(:user) { create(:user) } let(:user) { create(:user) }
subject(:mutation) { described_class.new(object: nil, context: { current_user: user }) } subject(:mutation) { described_class.new(object: nil, context: { current_user: user }) }
describe '#resolve' do describe '#resolve' do
......
...@@ -6,6 +6,7 @@ describe 'Dashboard snippets' do ...@@ -6,6 +6,7 @@ describe 'Dashboard snippets' do
context 'when the project has snippets' do context 'when the project has snippets' do
let(:project) { create(:project, :public) } let(:project) { create(:project, :public) }
let!(:snippets) { create_list(:project_snippet, 2, :public, author: project.owner, project: project) } let!(:snippets) { create_list(:project_snippet, 2, :public, author: project.owner, project: project) }
before do before do
allow(Snippet).to receive(:default_per_page).and_return(1) allow(Snippet).to receive(:default_per_page).and_return(1)
sign_in(project.owner) sign_in(project.owner)
...@@ -17,6 +18,7 @@ describe 'Dashboard snippets' do ...@@ -17,6 +18,7 @@ describe 'Dashboard snippets' do
context 'when there are no project snippets', :js do context 'when there are no project snippets', :js do
let(:project) { create(:project, :public) } let(:project) { create(:project, :public) }
before do before do
sign_in(project.owner) sign_in(project.owner)
visit dashboard_snippets_path visit dashboard_snippets_path
......
...@@ -70,6 +70,7 @@ describe 'issue move to another project' do ...@@ -70,6 +70,7 @@ describe 'issue move to another project' do
context 'user does not have permission to move the issue to a project', :js do context 'user does not have permission to move the issue to a project', :js do
let!(:private_project) { create(:project, :private) } let!(:private_project) { create(:project, :private) }
let(:another_project) { create(:project) } let(:another_project) { create(:project) }
before do before do
another_project.add_guest(user) another_project.add_guest(user)
end end
......
...@@ -6,6 +6,7 @@ describe "User views issues" do ...@@ -6,6 +6,7 @@ describe "User views issues" do
let!(:closed_issue) { create(:closed_issue, project: project) } let!(:closed_issue) { create(:closed_issue, project: project) }
let!(:open_issue1) { create(:issue, project: project) } let!(:open_issue1) { create(:issue, project: project) }
let!(:open_issue2) { create(:issue, project: project) } let!(:open_issue2) { create(:issue, project: project) }
set(:user) { create(:user) } set(:user) { create(:user) }
shared_examples "opens issue from list" do shared_examples "opens issue from list" do
......
...@@ -9,6 +9,7 @@ describe 'User sorts merge requests' do ...@@ -9,6 +9,7 @@ describe 'User sorts merge requests' do
let!(:merge_request2) do let!(:merge_request2) do
create(:merge_request_with_diffs, source_project: project, target_project: project, source_branch: 'merge-test') create(:merge_request_with_diffs, source_project: project, target_project: project, source_branch: 'merge-test')
end end
set(:user) { create(:user) } set(:user) { create(:user) }
set(:group) { create(:group) } set(:group) { create(:group) }
set(:group_member) { create(:group_member, :maintainer, user: user, group: group) } set(:group_member) { create(:group_member, :maintainer, user: user, group: group) }
......
...@@ -113,6 +113,7 @@ describe 'User views open merge requests' do ...@@ -113,6 +113,7 @@ describe 'User views open merge requests' do
context 'when project is internal' do context 'when project is internal' do
let!(:merge_request) { create(:merge_request, source_project: project, target_project: project) } let!(:merge_request) { create(:merge_request, source_project: project, target_project: project) }
set(:project) { create(:project, :internal, :repository) } set(:project) { create(:project, :internal, :repository) }
context 'when signed in' do context 'when signed in' do
......
...@@ -33,6 +33,7 @@ describe 'OAuth Login', :js, :allow_forgery_protection do ...@@ -33,6 +33,7 @@ describe 'OAuth Login', :js, :allow_forgery_protection do
let(:remember_me) { false } let(:remember_me) { false }
let(:user) { create(:omniauth_user, extern_uid: uid, provider: provider.to_s) } let(:user) { create(:omniauth_user, extern_uid: uid, provider: provider.to_s) }
let(:two_factor_user) { create(:omniauth_user, :two_factor, extern_uid: uid, provider: provider.to_s) } let(:two_factor_user) { create(:omniauth_user, :two_factor, extern_uid: uid, provider: provider.to_s) }
provider == :salesforce ? let(:additional_info) { { extra: { email_verified: true } } } : let(:additional_info) { {} } provider == :salesforce ? let(:additional_info) { { extra: { email_verified: true } } } : let(:additional_info) { {} }
before do before do
......
...@@ -34,6 +34,7 @@ describe 'Member autocomplete', :js do ...@@ -34,6 +34,7 @@ describe 'Member autocomplete', :js do
context 'adding a new note on a Issue' do context 'adding a new note on a Issue' do
let(:noteable) { create(:issue, author: author, project: project) } let(:noteable) { create(:issue, author: author, project: project) }
before do before do
visit project_issue_path(project, noteable) visit project_issue_path(project, noteable)
end end
...@@ -47,6 +48,7 @@ describe 'Member autocomplete', :js do ...@@ -47,6 +48,7 @@ describe 'Member autocomplete', :js do
create(:merge_request, source_project: project, create(:merge_request, source_project: project,
target_project: project, author: author) target_project: project, author: author)
end end
before do before do
visit project_merge_request_path(project, noteable) visit project_merge_request_path(project, noteable)
end end
......
...@@ -194,6 +194,7 @@ describe 'Gcp Cluster', :js, :do_not_mock_admin_mode do ...@@ -194,6 +194,7 @@ describe 'Gcp Cluster', :js, :do_not_mock_admin_mode do
context 'when third party offers are disabled' do context 'when third party offers are disabled' do
let(:admin) { create(:admin) } let(:admin) { create(:admin) }
before do before do
stub_env('IN_MEMORY_APPLICATION_SETTINGS', 'false') stub_env('IN_MEMORY_APPLICATION_SETTINGS', 'false')
sign_in(admin) sign_in(admin)
......
...@@ -193,6 +193,7 @@ describe 'Projects > Files > User edits files', :js do ...@@ -193,6 +193,7 @@ describe 'Projects > Files > User edits files', :js do
context 'when the user already had a fork of the project', :js do context 'when the user already had a fork of the project', :js do
let!(:forked_project) { fork_project(project2, user, namespace: user.namespace, repository: true) } let!(:forked_project) { fork_project(project2, user, namespace: user.namespace, repository: true) }
before do before do
visit(project2_tree_path_root_ref) visit(project2_tree_path_root_ref)
wait_for_requests wait_for_requests
......
...@@ -53,6 +53,7 @@ describe 'Internal Group access' do ...@@ -53,6 +53,7 @@ describe 'Internal Group access' do
describe 'GET /groups/:path/merge_requests' do describe 'GET /groups/:path/merge_requests' do
let(:project) { create(:project, :internal, :repository, group: group) } let(:project) { create(:project, :internal, :repository, group: group) }
subject { merge_requests_group_path(group) } subject { merge_requests_group_path(group) }
it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:admin) }
......
...@@ -53,6 +53,7 @@ describe 'Private Group access' do ...@@ -53,6 +53,7 @@ describe 'Private Group access' do
describe 'GET /groups/:path/merge_requests' do describe 'GET /groups/:path/merge_requests' do
let(:project) { create(:project, :private, :repository, group: group) } let(:project) { create(:project, :private, :repository, group: group) }
subject { merge_requests_group_path(group) } subject { merge_requests_group_path(group) }
it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:admin) }
......
...@@ -53,6 +53,7 @@ describe 'Public Group access' do ...@@ -53,6 +53,7 @@ describe 'Public Group access' do
describe 'GET /groups/:path/merge_requests' do describe 'GET /groups/:path/merge_requests' do
let(:project) { create(:project, :public, :repository, group: group) } let(:project) { create(:project, :public, :repository, group: group) }
subject { merge_requests_group_path(group) } subject { merge_requests_group_path(group) }
it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:admin) }
......
...@@ -129,6 +129,7 @@ describe "Internal Project Access" do ...@@ -129,6 +129,7 @@ describe "Internal Project Access" do
describe "GET /:project_path/blob" do describe "GET /:project_path/blob" do
let(:commit) { project.repository.commit } let(:commit) { project.repository.commit }
subject { project_blob_path(project, File.join(commit.id, '.gitignore')) } subject { project_blob_path(project, File.join(commit.id, '.gitignore')) }
it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:admin) }
...@@ -186,6 +187,7 @@ describe "Internal Project Access" do ...@@ -186,6 +187,7 @@ describe "Internal Project Access" do
describe "GET /:project_path/issues/:id/edit" do describe "GET /:project_path/issues/:id/edit" do
let(:issue) { create(:issue, project: project) } let(:issue) { create(:issue, project: project) }
subject { edit_project_issue_path(project, issue) } subject { edit_project_issue_path(project, issue) }
it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:admin) }
...@@ -327,6 +329,7 @@ describe "Internal Project Access" do ...@@ -327,6 +329,7 @@ describe "Internal Project Access" do
describe "GET /:project_path/pipelines/:id" do describe "GET /:project_path/pipelines/:id" do
let(:pipeline) { create(:ci_pipeline, project: project) } let(:pipeline) { create(:ci_pipeline, project: project) }
subject { project_pipeline_path(project, pipeline) } subject { project_pipeline_path(project, pipeline) }
it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:admin) }
...@@ -379,6 +382,7 @@ describe "Internal Project Access" do ...@@ -379,6 +382,7 @@ describe "Internal Project Access" do
describe "GET /:project_path/builds/:id" do describe "GET /:project_path/builds/:id" do
let(:pipeline) { create(:ci_pipeline, project: project) } let(:pipeline) { create(:ci_pipeline, project: project) }
let(:build) { create(:ci_build, pipeline: pipeline) } let(:build) { create(:ci_build, pipeline: pipeline) }
subject { project_job_path(project, build.id) } subject { project_job_path(project, build.id) }
context "when allowed for public and internal" do context "when allowed for public and internal" do
...@@ -417,6 +421,7 @@ describe "Internal Project Access" do ...@@ -417,6 +421,7 @@ describe "Internal Project Access" do
describe 'GET /:project_path/builds/:id/trace' do describe 'GET /:project_path/builds/:id/trace' do
let(:pipeline) { create(:ci_pipeline, project: project) } let(:pipeline) { create(:ci_pipeline, project: project) }
let(:build) { create(:ci_build, pipeline: pipeline) } let(:build) { create(:ci_build, pipeline: pipeline) }
subject { trace_project_job_path(project, build.id) } subject { trace_project_job_path(project, build.id) }
context 'when allowed for public and internal' do context 'when allowed for public and internal' do
...@@ -482,6 +487,7 @@ describe "Internal Project Access" do ...@@ -482,6 +487,7 @@ describe "Internal Project Access" do
describe "GET /:project_path/-/environments/:id" do describe "GET /:project_path/-/environments/:id" do
let(:environment) { create(:environment, project: project) } let(:environment) { create(:environment, project: project) }
subject { project_environment_path(project, environment) } subject { project_environment_path(project, environment) }
it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:admin) }
...@@ -497,6 +503,7 @@ describe "Internal Project Access" do ...@@ -497,6 +503,7 @@ describe "Internal Project Access" do
describe "GET /:project_path/-/environments/:id/deployments" do describe "GET /:project_path/-/environments/:id/deployments" do
let(:environment) { create(:environment, project: project) } let(:environment) { create(:environment, project: project) }
subject { project_environment_deployments_path(project, environment) } subject { project_environment_deployments_path(project, environment) }
it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:admin) }
......
...@@ -129,6 +129,7 @@ describe "Private Project Access" do ...@@ -129,6 +129,7 @@ describe "Private Project Access" do
describe "GET /:project_path/blob" do describe "GET /:project_path/blob" do
let(:commit) { project.repository.commit } let(:commit) { project.repository.commit }
subject { project_blob_path(project, File.join(commit.id, '.gitignore')) } subject { project_blob_path(project, File.join(commit.id, '.gitignore')) }
it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:admin) }
...@@ -186,6 +187,7 @@ describe "Private Project Access" do ...@@ -186,6 +187,7 @@ describe "Private Project Access" do
describe "GET /:project_path/issues/:id/edit" do describe "GET /:project_path/issues/:id/edit" do
let(:issue) { create(:issue, project: project) } let(:issue) { create(:issue, project: project) }
subject { edit_project_issue_path(project, issue) } subject { edit_project_issue_path(project, issue) }
it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:admin) }
...@@ -311,6 +313,7 @@ describe "Private Project Access" do ...@@ -311,6 +313,7 @@ describe "Private Project Access" do
describe "GET /:project_path/pipelines/:id" do describe "GET /:project_path/pipelines/:id" do
let(:pipeline) { create(:ci_pipeline, project: project) } let(:pipeline) { create(:ci_pipeline, project: project) }
subject { project_pipeline_path(project, pipeline) } subject { project_pipeline_path(project, pipeline) }
it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:admin) }
...@@ -365,6 +368,7 @@ describe "Private Project Access" do ...@@ -365,6 +368,7 @@ describe "Private Project Access" do
describe "GET /:project_path/builds/:id" do describe "GET /:project_path/builds/:id" do
let(:pipeline) { create(:ci_pipeline, project: project) } let(:pipeline) { create(:ci_pipeline, project: project) }
let(:build) { create(:ci_build, pipeline: pipeline) } let(:build) { create(:ci_build, pipeline: pipeline) }
subject { project_job_path(project, build.id) } subject { project_job_path(project, build.id) }
it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:admin) }
...@@ -398,6 +402,7 @@ describe "Private Project Access" do ...@@ -398,6 +402,7 @@ describe "Private Project Access" do
describe 'GET /:project_path/builds/:id/trace' do describe 'GET /:project_path/builds/:id/trace' do
let(:pipeline) { create(:ci_pipeline, project: project) } let(:pipeline) { create(:ci_pipeline, project: project) }
let(:build) { create(:ci_build, pipeline: pipeline) } let(:build) { create(:ci_build, pipeline: pipeline) }
subject { trace_project_job_path(project, build.id) } subject { trace_project_job_path(project, build.id) }
it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:admin) }
...@@ -443,6 +448,7 @@ describe "Private Project Access" do ...@@ -443,6 +448,7 @@ describe "Private Project Access" do
describe "GET /:project_path/-/environments/:id" do describe "GET /:project_path/-/environments/:id" do
let(:environment) { create(:environment, project: project) } let(:environment) { create(:environment, project: project) }
subject { project_environment_path(project, environment) } subject { project_environment_path(project, environment) }
it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:admin) }
...@@ -458,6 +464,7 @@ describe "Private Project Access" do ...@@ -458,6 +464,7 @@ describe "Private Project Access" do
describe "GET /:project_path/-/environments/:id/deployments" do describe "GET /:project_path/-/environments/:id/deployments" do
let(:environment) { create(:environment, project: project) } let(:environment) { create(:environment, project: project) }
subject { project_environment_deployments_path(project, environment) } subject { project_environment_deployments_path(project, environment) }
it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:admin) }
......
...@@ -143,6 +143,7 @@ describe "Public Project Access" do ...@@ -143,6 +143,7 @@ describe "Public Project Access" do
describe "GET /:project_path/pipelines/:id" do describe "GET /:project_path/pipelines/:id" do
let(:pipeline) { create(:ci_pipeline, project: project) } let(:pipeline) { create(:ci_pipeline, project: project) }
subject { project_pipeline_path(project, pipeline) } subject { project_pipeline_path(project, pipeline) }
it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:admin) }
...@@ -195,6 +196,7 @@ describe "Public Project Access" do ...@@ -195,6 +196,7 @@ describe "Public Project Access" do
describe "GET /:project_path/builds/:id" do describe "GET /:project_path/builds/:id" do
let(:pipeline) { create(:ci_pipeline, project: project) } let(:pipeline) { create(:ci_pipeline, project: project) }
let(:build) { create(:ci_build, pipeline: pipeline) } let(:build) { create(:ci_build, pipeline: pipeline) }
subject { project_job_path(project, build.id) } subject { project_job_path(project, build.id) }
context "when allowed for public" do context "when allowed for public" do
...@@ -233,6 +235,7 @@ describe "Public Project Access" do ...@@ -233,6 +235,7 @@ describe "Public Project Access" do
describe 'GET /:project_path/builds/:id/trace' do describe 'GET /:project_path/builds/:id/trace' do
let(:pipeline) { create(:ci_pipeline, project: project) } let(:pipeline) { create(:ci_pipeline, project: project) }
let(:build) { create(:ci_build, pipeline: pipeline) } let(:build) { create(:ci_build, pipeline: pipeline) }
subject { trace_project_job_path(project, build.id) } subject { trace_project_job_path(project, build.id) }
context 'when allowed for public' do context 'when allowed for public' do
...@@ -298,6 +301,7 @@ describe "Public Project Access" do ...@@ -298,6 +301,7 @@ describe "Public Project Access" do
describe "GET /:project_path/-/environments/:id" do describe "GET /:project_path/-/environments/:id" do
let(:environment) { create(:environment, project: project) } let(:environment) { create(:environment, project: project) }
subject { project_environment_path(project, environment) } subject { project_environment_path(project, environment) }
it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:admin) }
...@@ -313,6 +317,7 @@ describe "Public Project Access" do ...@@ -313,6 +317,7 @@ describe "Public Project Access" do
describe "GET /:project_path/-/environments/:id/deployments" do describe "GET /:project_path/-/environments/:id/deployments" do
let(:environment) { create(:environment, project: project) } let(:environment) { create(:environment, project: project) }
subject { project_environment_deployments_path(project, environment) } subject { project_environment_deployments_path(project, environment) }
it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:admin) }
...@@ -399,6 +404,7 @@ describe "Public Project Access" do ...@@ -399,6 +404,7 @@ describe "Public Project Access" do
describe "GET /:project_path/issues/:id/edit" do describe "GET /:project_path/issues/:id/edit" do
let(:issue) { create(:issue, project: project) } let(:issue) { create(:issue, project: project) }
subject { edit_project_issue_path(project, issue) } subject { edit_project_issue_path(project, issue) }
it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:admin) }
......
...@@ -146,6 +146,7 @@ describe 'Task Lists' do ...@@ -146,6 +146,7 @@ describe 'Task Lists' do
describe 'for Notes' do describe 'for Notes' do
let!(:issue) { create(:issue, author: user, project: project) } let!(:issue) { create(:issue, author: user, project: project) }
describe 'multiple tasks' do describe 'multiple tasks' do
let!(:note) do let!(:note) do
create(:note, note: markdown, noteable: issue, create(:note, note: markdown, noteable: issue,
......
...@@ -406,6 +406,7 @@ describe 'Login' do ...@@ -406,6 +406,7 @@ describe 'Login' do
describe 'with required two-factor authentication enabled' do describe 'with required two-factor authentication enabled' do
let(:user) { create(:user) } let(:user) { create(:user) }
# TODO: otp_grace_period_started_at # TODO: otp_grace_period_started_at
context 'global setting' do context 'global setting' do
......
...@@ -4,6 +4,7 @@ require 'spec_helper' ...@@ -4,6 +4,7 @@ require 'spec_helper'
describe ClustersFinder do describe ClustersFinder do
let(:project) { create(:project) } let(:project) { create(:project) }
set(:user) { create(:user) } set(:user) { create(:user) }
describe '#execute' do describe '#execute' do
......
...@@ -6,6 +6,7 @@ describe GroupDescendantsFinder do ...@@ -6,6 +6,7 @@ describe GroupDescendantsFinder do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:group) { create(:group) } let(:group) { create(:group) }
let(:params) { {} } let(:params) { {} }
subject(:finder) do subject(:finder) do
described_class.new(current_user: user, parent_group: group, params: params) described_class.new(current_user: user, parent_group: group, params: params)
end end
......
...@@ -132,11 +132,13 @@ describe GroupProjectsFinder do ...@@ -132,11 +132,13 @@ describe GroupProjectsFinder do
context "only shared" do context "only shared" do
let(:options) { { only_shared: true } } let(:options) { { only_shared: true } }
it { is_expected.to eq([shared_project_3, shared_project_2, shared_project_1]) } it { is_expected.to eq([shared_project_3, shared_project_2, shared_project_1]) }
end end
context "only owned" do context "only owned" do
let(:options) { { only_owned: true } } let(:options) { { only_owned: true } }
it { is_expected.to eq([private_project, public_project]) } it { is_expected.to eq([private_project, public_project]) }
end end
......
...@@ -111,6 +111,7 @@ describe GroupsFinder do ...@@ -111,6 +111,7 @@ describe GroupsFinder do
context 'authorized to private project' do context 'authorized to private project' do
context 'project one level deep' do context 'project one level deep' do
let!(:subproject) { create(:project, :private, namespace: private_subgroup) } let!(:subproject) { create(:project, :private, namespace: private_subgroup) }
before do before do
subproject.add_guest(user) subproject.add_guest(user)
end end
...@@ -129,6 +130,7 @@ describe GroupsFinder do ...@@ -129,6 +130,7 @@ describe GroupsFinder do
context 'project two levels deep' do context 'project two levels deep' do
let!(:private_subsubgroup) { create(:group, :private, parent: private_subgroup) } let!(:private_subsubgroup) { create(:group, :private, parent: private_subgroup) }
let!(:subsubproject) { create(:project, :private, namespace: private_subsubgroup) } let!(:subsubproject) { create(:project, :private, namespace: private_subsubgroup) }
before do before do
subsubproject.add_guest(user) subsubproject.add_guest(user)
end end
......
...@@ -786,6 +786,7 @@ describe IssuesFinder do ...@@ -786,6 +786,7 @@ describe IssuesFinder do
describe '#with_confidentiality_access_check' do describe '#with_confidentiality_access_check' do
let(:guest) { create(:user) } let(:guest) { create(:user) }
set(:authorized_user) { create(:user) } set(:authorized_user) { create(:user) }
set(:project) { create(:project, namespace: authorized_user.namespace) } set(:project) { create(:project, namespace: authorized_user.namespace) }
set(:public_issue) { create(:issue, project: project) } set(:public_issue) { create(:issue, project: project) }
......
...@@ -6,6 +6,7 @@ describe MergeRequestTargetProjectFinder do ...@@ -6,6 +6,7 @@ describe MergeRequestTargetProjectFinder do
include ProjectForksHelper include ProjectForksHelper
let(:user) { create(:user) } let(:user) { create(:user) }
subject(:finder) { described_class.new(current_user: user, source_project: forked_project) } subject(:finder) { described_class.new(current_user: user, source_project: forked_project) }
shared_examples 'finding related projects' do shared_examples 'finding related projects' do
......
...@@ -6,6 +6,7 @@ describe PipelinesFinder do ...@@ -6,6 +6,7 @@ describe PipelinesFinder do
let(:project) { create(:project, :public, :repository) } let(:project) { create(:project, :public, :repository) }
let(:current_user) { nil } let(:current_user) { nil }
let(:params) { {} } let(:params) { {} }
subject { described_class.new(project, current_user, params).execute } subject { described_class.new(project, current_user, params).execute }
describe "#execute" do describe "#execute" do
......
...@@ -181,6 +181,7 @@ describe ProjectsFinder, :do_not_mock_admin_mode do ...@@ -181,6 +181,7 @@ describe ProjectsFinder, :do_not_mock_admin_mode do
describe 'filter by non_public' do describe 'filter by non_public' do
let(:params) { { non_public: true } } let(:params) { { non_public: true } }
before do before do
private_project.add_developer(current_user) private_project.add_developer(current_user)
end end
...@@ -190,6 +191,7 @@ describe ProjectsFinder, :do_not_mock_admin_mode do ...@@ -190,6 +191,7 @@ describe ProjectsFinder, :do_not_mock_admin_mode do
describe 'filter by starred' do describe 'filter by starred' do
let(:params) { { starred: true } } let(:params) { { starred: true } }
before do before do
current_user.toggle_star(public_project) current_user.toggle_star(public_project)
end end
......
...@@ -96,6 +96,7 @@ describe TagsFinder do ...@@ -96,6 +96,7 @@ describe TagsFinder do
context 'filter and sort' do context 'filter and sort' do
let(:tags_to_compare) { %w[v1.0.0 v1.1.0] } let(:tags_to_compare) { %w[v1.0.0 v1.1.0] }
subject { described_class.new(repository, params).execute.select { |tag| tags_to_compare.include?(tag.name) } } subject { described_class.new(repository, params).execute.select { |tag| tags_to_compare.include?(tag.name) } }
context 'when sort by updated_desc' do context 'when sort by updated_desc' do
......
...@@ -10,6 +10,7 @@ describe Mutations::ResolvesGroup do ...@@ -10,6 +10,7 @@ describe Mutations::ResolvesGroup do
end end
let(:context) { double } let(:context) { double }
subject(:mutation) { mutation_class.new(object: nil, context: context) } subject(:mutation) { mutation_class.new(object: nil, context: context) }
it 'uses the GroupsResolver to resolve groups by path' do it 'uses the GroupsResolver to resolve groups by path' do
......
...@@ -10,6 +10,7 @@ describe Mutations::ResolvesProject do ...@@ -10,6 +10,7 @@ describe Mutations::ResolvesProject do
end end
let(:context) { double } let(:context) { double }
subject(:mutation) { mutation_class.new(object: nil, context: context) } subject(:mutation) { mutation_class.new(object: nil, context: context) }
it 'uses the ProjectsResolver to resolve projects by path' do it 'uses the ProjectsResolver to resolve projects by path' do
......
...@@ -5,11 +5,13 @@ require 'spec_helper' ...@@ -5,11 +5,13 @@ require 'spec_helper'
describe Mutations::Issues::SetConfidential do describe Mutations::Issues::SetConfidential do
let(:issue) { create(:issue) } let(:issue) { create(:issue) }
let(:user) { create(:user) } let(:user) { create(:user) }
subject(:mutation) { described_class.new(object: nil, context: { current_user: user }) } subject(:mutation) { described_class.new(object: nil, context: { current_user: user }) }
describe '#resolve' do describe '#resolve' do
let(:confidential) { true } let(:confidential) { true }
let(:mutated_issue) { subject[:issue] } let(:mutated_issue) { subject[:issue] }
subject { mutation.resolve(project_path: issue.project.full_path, iid: issue.iid, confidential: confidential) } subject { mutation.resolve(project_path: issue.project.full_path, iid: issue.iid, confidential: confidential) }
it 'raises an error if the resource is not accessible to the user' do it 'raises an error if the resource is not accessible to the user' do
......
...@@ -5,11 +5,13 @@ require 'spec_helper' ...@@ -5,11 +5,13 @@ require 'spec_helper'
describe Mutations::Issues::SetDueDate do describe Mutations::Issues::SetDueDate do
let(:issue) { create(:issue) } let(:issue) { create(:issue) }
let(:user) { create(:user) } let(:user) { create(:user) }
subject(:mutation) { described_class.new(object: nil, context: { current_user: user }) } subject(:mutation) { described_class.new(object: nil, context: { current_user: user }) }
describe '#resolve' do describe '#resolve' do
let(:due_date) { 2.days.since } let(:due_date) { 2.days.since }
let(:mutated_issue) { subject[:issue] } let(:mutated_issue) { subject[:issue] }
subject { mutation.resolve(project_path: issue.project.full_path, iid: issue.iid, due_date: due_date) } subject { mutation.resolve(project_path: issue.project.full_path, iid: issue.iid, due_date: due_date) }
it 'raises an error if the resource is not accessible to the user' do it 'raises an error if the resource is not accessible to the user' do
......
...@@ -5,6 +5,7 @@ require 'spec_helper' ...@@ -5,6 +5,7 @@ require 'spec_helper'
describe Mutations::MergeRequests::SetAssignees do describe Mutations::MergeRequests::SetAssignees do
let(:merge_request) { create(:merge_request) } let(:merge_request) { create(:merge_request) }
let(:user) { create(:user) } let(:user) { create(:user) }
subject(:mutation) { described_class.new(object: nil, context: { current_user: user }) } subject(:mutation) { described_class.new(object: nil, context: { current_user: user }) }
describe '#resolve' do describe '#resolve' do
...@@ -12,6 +13,7 @@ describe Mutations::MergeRequests::SetAssignees do ...@@ -12,6 +13,7 @@ describe Mutations::MergeRequests::SetAssignees do
let(:assignee2) { create(:user) } let(:assignee2) { create(:user) }
let(:assignee_usernames) { [assignee.username] } let(:assignee_usernames) { [assignee.username] }
let(:mutated_merge_request) { subject[:merge_request] } let(:mutated_merge_request) { subject[:merge_request] }
subject { mutation.resolve(project_path: merge_request.project.full_path, iid: merge_request.iid, assignee_usernames: assignee_usernames) } subject { mutation.resolve(project_path: merge_request.project.full_path, iid: merge_request.iid, assignee_usernames: assignee_usernames) }
before do before do
......
...@@ -5,6 +5,7 @@ require 'spec_helper' ...@@ -5,6 +5,7 @@ require 'spec_helper'
describe Mutations::MergeRequests::SetLabels do describe Mutations::MergeRequests::SetLabels do
let(:merge_request) { create(:merge_request) } let(:merge_request) { create(:merge_request) }
let(:user) { create(:user) } let(:user) { create(:user) }
subject(:mutation) { described_class.new(object: nil, context: { current_user: user }) } subject(:mutation) { described_class.new(object: nil, context: { current_user: user }) }
describe '#resolve' do describe '#resolve' do
...@@ -12,6 +13,7 @@ describe Mutations::MergeRequests::SetLabels do ...@@ -12,6 +13,7 @@ describe Mutations::MergeRequests::SetLabels do
let(:label2) { create(:label, project: merge_request.project) } let(:label2) { create(:label, project: merge_request.project) }
let(:label_ids) { [label.to_global_id] } let(:label_ids) { [label.to_global_id] }
let(:mutated_merge_request) { subject[:merge_request] } let(:mutated_merge_request) { subject[:merge_request] }
subject { mutation.resolve(project_path: merge_request.project.full_path, iid: merge_request.iid, label_ids: label_ids) } subject { mutation.resolve(project_path: merge_request.project.full_path, iid: merge_request.iid, label_ids: label_ids) }
it 'raises an error if the resource is not accessible to the user' do it 'raises an error if the resource is not accessible to the user' do
......
...@@ -5,11 +5,13 @@ require 'spec_helper' ...@@ -5,11 +5,13 @@ require 'spec_helper'
describe Mutations::MergeRequests::SetLocked do describe Mutations::MergeRequests::SetLocked do
let(:merge_request) { create(:merge_request) } let(:merge_request) { create(:merge_request) }
let(:user) { create(:user) } let(:user) { create(:user) }
subject(:mutation) { described_class.new(object: nil, context: { current_user: user }) } subject(:mutation) { described_class.new(object: nil, context: { current_user: user }) }
describe '#resolve' do describe '#resolve' do
let(:locked) { true } let(:locked) { true }
let(:mutated_merge_request) { subject[:merge_request] } let(:mutated_merge_request) { subject[:merge_request] }
subject { mutation.resolve(project_path: merge_request.project.full_path, iid: merge_request.iid, locked: locked) } subject { mutation.resolve(project_path: merge_request.project.full_path, iid: merge_request.iid, locked: locked) }
it 'raises an error if the resource is not accessible to the user' do it 'raises an error if the resource is not accessible to the user' do
......
...@@ -5,11 +5,13 @@ require 'spec_helper' ...@@ -5,11 +5,13 @@ require 'spec_helper'
describe Mutations::MergeRequests::SetMilestone do describe Mutations::MergeRequests::SetMilestone do
let(:merge_request) { create(:merge_request) } let(:merge_request) { create(:merge_request) }
let(:user) { create(:user) } let(:user) { create(:user) }
subject(:mutation) { described_class.new(object: nil, context: { current_user: user }) } subject(:mutation) { described_class.new(object: nil, context: { current_user: user }) }
describe '#resolve' do describe '#resolve' do
let(:milestone) { create(:milestone, project: merge_request.project) } let(:milestone) { create(:milestone, project: merge_request.project) }
let(:mutated_merge_request) { subject[:merge_request] } let(:mutated_merge_request) { subject[:merge_request] }
subject { mutation.resolve(project_path: merge_request.project.full_path, iid: merge_request.iid, milestone: milestone) } subject { mutation.resolve(project_path: merge_request.project.full_path, iid: merge_request.iid, milestone: milestone) }
it 'raises an error if the resource is not accessible to the user' do it 'raises an error if the resource is not accessible to the user' do
......
...@@ -6,11 +6,13 @@ describe Mutations::MergeRequests::SetSubscription do ...@@ -6,11 +6,13 @@ describe Mutations::MergeRequests::SetSubscription do
let(:merge_request) { create(:merge_request) } let(:merge_request) { create(:merge_request) }
let(:project) { merge_request.project } let(:project) { merge_request.project }
let(:user) { create(:user) } let(:user) { create(:user) }
subject(:mutation) { described_class.new(object: nil, context: { current_user: user }) } subject(:mutation) { described_class.new(object: nil, context: { current_user: user }) }
describe '#resolve' do describe '#resolve' do
let(:subscribe) { true } let(:subscribe) { true }
let(:mutated_merge_request) { subject[:merge_request] } let(:mutated_merge_request) { subject[:merge_request] }
subject { mutation.resolve(project_path: merge_request.project.full_path, iid: merge_request.iid, subscribed_state: subscribe) } subject { mutation.resolve(project_path: merge_request.project.full_path, iid: merge_request.iid, subscribed_state: subscribe) }
it 'raises an error if the resource is not accessible to the user' do it 'raises an error if the resource is not accessible to the user' do
......
...@@ -5,11 +5,13 @@ require 'spec_helper' ...@@ -5,11 +5,13 @@ require 'spec_helper'
describe Mutations::MergeRequests::SetWip do describe Mutations::MergeRequests::SetWip do
let(:merge_request) { create(:merge_request) } let(:merge_request) { create(:merge_request) }
let(:user) { create(:user) } let(:user) { create(:user) }
subject(:mutation) { described_class.new(object: nil, context: { current_user: user }) } subject(:mutation) { described_class.new(object: nil, context: { current_user: user }) }
describe '#resolve' do describe '#resolve' do
let(:wip) { true } let(:wip) { true }
let(:mutated_merge_request) { subject[:merge_request] } let(:mutated_merge_request) { subject[:merge_request] }
subject { mutation.resolve(project_path: merge_request.project.full_path, iid: merge_request.iid, wip: wip) } subject { mutation.resolve(project_path: merge_request.project.full_path, iid: merge_request.iid, wip: wip) }
it 'raises an error if the resource is not accessible to the user' do it 'raises an error if the resource is not accessible to the user' do
......
...@@ -16,6 +16,7 @@ describe ResolvesPipelines do ...@@ -16,6 +16,7 @@ describe ResolvesPipelines do
end end
let(:current_user) { create(:user) } let(:current_user) { create(:user) }
set(:project) { create(:project, :private) } set(:project) { create(:project, :private) }
set(:pipeline) { create(:ci_pipeline, project: project) } set(:pipeline) { create(:ci_pipeline, project: project) }
set(:failed_pipeline) { create(:ci_pipeline, :failed, project: project) } set(:failed_pipeline) { create(:ci_pipeline, :failed, project: project) }
......
...@@ -20,6 +20,7 @@ describe Resolvers::ErrorTracking::SentryDetailedErrorResolver do ...@@ -20,6 +20,7 @@ describe Resolvers::ErrorTracking::SentryDetailedErrorResolver do
describe '#resolve' do describe '#resolve' do
let(:args) { { id: issue_global_id(1234) } } let(:args) { { id: issue_global_id(1234) } }
it 'fetches the data via the sentry API' do it 'fetches the data via the sentry API' do
resolve_error(args) resolve_error(args)
......
...@@ -6,6 +6,7 @@ describe Types::PermissionTypes::BasePermissionType do ...@@ -6,6 +6,7 @@ describe Types::PermissionTypes::BasePermissionType do
let(:permitable) { double('permittable') } let(:permitable) { double('permittable') }
let(:current_user) { build(:user) } let(:current_user) { build(:user) }
let(:context) { { current_user: current_user } } let(:context) { { current_user: current_user } }
subject(:test_type) do subject(:test_type) do
Class.new(described_class) do Class.new(described_class) do
graphql_name 'TestClass' graphql_name 'TestClass'
......
...@@ -193,6 +193,7 @@ describe AvatarsHelper do ...@@ -193,6 +193,7 @@ describe AvatarsHelper do
describe '#user_avatar_without_link' do describe '#user_avatar_without_link' do
let(:options) { { user: user } } let(:options) { { user: user } }
subject { helper.user_avatar_without_link(options) } subject { helper.user_avatar_without_link(options) }
it 'displays user avatar' do it 'displays user avatar' do
......
...@@ -5,6 +5,7 @@ require 'spec_helper' ...@@ -5,6 +5,7 @@ require 'spec_helper'
describe EventsHelper do describe EventsHelper do
describe '#event_commit_title' do describe '#event_commit_title' do
let(:message) { 'foo & bar ' + 'A' * 70 + '\n' + 'B' * 80 } let(:message) { 'foo & bar ' + 'A' * 70 + '\n' + 'B' * 80 }
subject { helper.event_commit_title(message) } subject { helper.event_commit_title(message) }
it 'returns the first line, truncated to 70 chars' do it 'returns the first line, truncated to 70 chars' do
......
...@@ -127,6 +127,7 @@ describe GroupsHelper do ...@@ -127,6 +127,7 @@ describe GroupsHelper do
sub_sub_owner: sub_sub_owner sub_sub_owner: sub_sub_owner
} }
end end
subject { helper.share_with_group_lock_help_text(sub_subgroup) } subject { helper.share_with_group_lock_help_text(sub_subgroup) }
where(:root_share_with_group_locked, :subgroup_share_with_group_locked, :sub_subgroup_share_with_group_locked, :current_user, :help_text, :linked_ancestor) do where(:root_share_with_group_locked, :subgroup_share_with_group_locked, :sub_subgroup_share_with_group_locked, :current_user, :help_text, :linked_ancestor) do
...@@ -194,6 +195,7 @@ describe GroupsHelper do ...@@ -194,6 +195,7 @@ describe GroupsHelper do
describe '#group_container_registry_nav' do describe '#group_container_registry_nav' do
let(:group) { create(:group, :public) } let(:group) { create(:group, :public) }
let(:user) { create(:user) } let(:user) { create(:user) }
before do before do
stub_container_registry_config(enabled: true) stub_container_registry_config(enabled: true)
allow(helper).to receive(:current_user) { user } allow(helper).to receive(:current_user) { user }
...@@ -229,6 +231,7 @@ describe GroupsHelper do ...@@ -229,6 +231,7 @@ describe GroupsHelper do
describe '#group_sidebar_links' do describe '#group_sidebar_links' do
let(:group) { create(:group, :public) } let(:group) { create(:group, :public) }
let(:user) { create(:user) } let(:user) { create(:user) }
before do before do
group.add_owner(user) group.add_owner(user)
allow(helper).to receive(:current_user) { user } allow(helper).to receive(:current_user) { user }
......
...@@ -278,6 +278,7 @@ describe IssuablesHelper do ...@@ -278,6 +278,7 @@ describe IssuablesHelper do
describe '#assignee_sidebar_data' do describe '#assignee_sidebar_data' do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:merge_request) { nil } let(:merge_request) { nil }
subject { helper.assignee_sidebar_data(user, merge_request: merge_request) } subject { helper.assignee_sidebar_data(user, merge_request: merge_request) }
it 'returns hash of assignee data' do it 'returns hash of assignee data' do
......
...@@ -274,6 +274,7 @@ describe LabelsHelper do ...@@ -274,6 +274,7 @@ describe LabelsHelper do
describe '#label_status_tooltip' do describe '#label_status_tooltip' do
let(:status) { 'unsubscribed'.inquiry } let(:status) { 'unsubscribed'.inquiry }
subject { label_status_tooltip(label.present(issuable_subject: nil), status) } subject { label_status_tooltip(label.present(issuable_subject: nil), status) }
context 'with a project label' do context 'with a project label' do
......
...@@ -44,6 +44,7 @@ describe MarkupHelper do ...@@ -44,6 +44,7 @@ describe MarkupHelper do
describe "override default project" do describe "override default project" do
let(:actual) { issue.to_reference } let(:actual) { issue.to_reference }
set(:second_project) { create(:project, :public) } set(:second_project) { create(:project, :public) }
set(:second_issue) { create(:issue, project: second_project) } set(:second_issue) { create(:issue, project: second_project) }
...@@ -55,6 +56,7 @@ describe MarkupHelper do ...@@ -55,6 +56,7 @@ describe MarkupHelper do
describe 'uploads' do describe 'uploads' do
let(:text) { "![ImageTest](/uploads/test.png)" } let(:text) { "![ImageTest](/uploads/test.png)" }
set(:group) { create(:group) } set(:group) { create(:group) }
subject { helper.markdown(text) } subject { helper.markdown(text) }
......
...@@ -54,6 +54,7 @@ describe MergeRequestsHelper do ...@@ -54,6 +54,7 @@ describe MergeRequestsHelper do
describe '#format_mr_branch_names' do describe '#format_mr_branch_names' do
describe 'within the same project' do describe 'within the same project' do
let(:merge_request) { create(:merge_request) } let(:merge_request) { create(:merge_request) }
subject { format_mr_branch_names(merge_request) } subject { format_mr_branch_names(merge_request) }
it { is_expected.to eq([merge_request.source_branch, merge_request.target_branch]) } it { is_expected.to eq([merge_request.source_branch, merge_request.target_branch]) }
......
...@@ -313,6 +313,7 @@ describe ProjectsHelper do ...@@ -313,6 +313,7 @@ describe ProjectsHelper do
describe '#link_to_project' do describe '#link_to_project' do
let(:group) { create(:group, name: 'group name with space') } let(:group) { create(:group, name: 'group name with space') }
let(:project) { create(:project, group: group, name: 'project name with space') } let(:project) { create(:project, group: group, name: 'project name with space') }
subject { link_to_project(project) } subject { link_to_project(project) }
it 'returns an HTML link to the project' do it 'returns an HTML link to the project' do
...@@ -544,6 +545,7 @@ describe ProjectsHelper do ...@@ -544,6 +545,7 @@ describe ProjectsHelper do
describe '#git_user_name' do describe '#git_user_name' do
let(:user) { double(:user, name: 'John "A" Doe53') } let(:user) { double(:user, name: 'John "A" Doe53') }
before do before do
allow(helper).to receive(:current_user).and_return(user) allow(helper).to receive(:current_user).and_return(user)
end end
...@@ -566,6 +568,7 @@ describe ProjectsHelper do ...@@ -566,6 +568,7 @@ describe ProjectsHelper do
context 'user logged in' do context 'user logged in' do
let(:user) { create(:user) } let(:user) { create(:user) }
before do before do
allow(helper).to receive(:current_user).and_return(user) allow(helper).to receive(:current_user).and_return(user)
end end
......
...@@ -324,6 +324,7 @@ describe Gitlab::Database do ...@@ -324,6 +324,7 @@ describe Gitlab::Database do
context 'with version < 9.5' do context 'with version < 9.5' do
let(:version) { 9.4 } let(:version) { 9.4 }
it 'refuses setting the upsert' do it 'refuses setting the upsert' do
expect(connection) expect(connection)
.not_to receive(:execute) .not_to receive(:execute)
......
...@@ -109,6 +109,7 @@ describe Notify do ...@@ -109,6 +109,7 @@ describe Notify do
describe 'that are reassigned' do describe 'that are reassigned' do
let(:previous_assignee) { create(:user, name: 'Previous Assignee') } let(:previous_assignee) { create(:user, name: 'Previous Assignee') }
subject { described_class.reassigned_issue_email(recipient.id, issue.id, [previous_assignee.id], current_user.id) } subject { described_class.reassigned_issue_email(recipient.id, issue.id, [previous_assignee.id], current_user.id) }
it_behaves_like 'a multiple recipients email' it_behaves_like 'a multiple recipients email'
...@@ -207,6 +208,7 @@ describe Notify do ...@@ -207,6 +208,7 @@ describe Notify do
describe 'status changed' do describe 'status changed' do
let(:status) { 'closed' } let(:status) { 'closed' }
subject { described_class.issue_status_changed_email(recipient.id, issue.id, status, current_user.id) } subject { described_class.issue_status_changed_email(recipient.id, issue.id, status, current_user.id) }
it_behaves_like 'an answer to an existing thread with reply-by-email enabled' do it_behaves_like 'an answer to an existing thread with reply-by-email enabled' do
...@@ -235,6 +237,7 @@ describe Notify do ...@@ -235,6 +237,7 @@ describe Notify do
describe 'moved to another project' do describe 'moved to another project' do
let(:new_issue) { create(:issue) } let(:new_issue) { create(:issue) }
subject { described_class.issue_moved_email(recipient, issue, new_issue, current_user) } subject { described_class.issue_moved_email(recipient, issue, new_issue, current_user) }
context 'when a user has permissions to access the new issue' do context 'when a user has permissions to access the new issue' do
...@@ -334,6 +337,7 @@ describe Notify do ...@@ -334,6 +337,7 @@ describe Notify do
describe 'that are reassigned' do describe 'that are reassigned' do
let(:previous_assignee) { create(:user, name: 'Previous Assignee') } let(:previous_assignee) { create(:user, name: 'Previous Assignee') }
subject { described_class.reassigned_merge_request_email(recipient.id, merge_request.id, [previous_assignee.id], current_user.id) } subject { described_class.reassigned_merge_request_email(recipient.id, merge_request.id, [previous_assignee.id], current_user.id) }
it_behaves_like 'a multiple recipients email' it_behaves_like 'a multiple recipients email'
...@@ -426,6 +430,7 @@ describe Notify do ...@@ -426,6 +430,7 @@ describe Notify do
describe 'status changed' do describe 'status changed' do
let(:status) { 'reopened' } let(:status) { 'reopened' }
subject { described_class.merge_request_status_email(recipient.id, merge_request.id, status, current_user.id) } subject { described_class.merge_request_status_email(recipient.id, merge_request.id, status, current_user.id) }
it_behaves_like 'an answer to an existing thread with reply-by-email enabled' do it_behaves_like 'an answer to an existing thread with reply-by-email enabled' do
...@@ -454,6 +459,7 @@ describe Notify do ...@@ -454,6 +459,7 @@ describe Notify do
describe 'that are merged' do describe 'that are merged' do
let(:merge_author) { create(:user) } let(:merge_author) { create(:user) }
subject { described_class.merged_merge_request_email(recipient.id, merge_request.id, merge_author.id) } subject { described_class.merged_merge_request_email(recipient.id, merge_request.id, merge_author.id) }
it_behaves_like 'a multiple recipients email' it_behaves_like 'a multiple recipients email'
...@@ -698,6 +704,7 @@ describe Notify do ...@@ -698,6 +704,7 @@ describe Notify do
describe 'project was moved' do describe 'project was moved' do
let(:recipient) { user } let(:recipient) { user }
subject { described_class.project_was_moved_email(project.id, user.id, "gitlab/gitlab") } subject { described_class.project_was_moved_email(project.id, user.id, "gitlab/gitlab") }
it_behaves_like 'an email sent to a user' it_behaves_like 'an email sent to a user'
...@@ -725,6 +732,7 @@ describe Notify do ...@@ -725,6 +732,7 @@ describe Notify do
project.request_access(user) project.request_access(user)
project.requesters.find_by(user_id: user.id) project.requesters.find_by(user_id: user.id)
end end
subject { described_class.member_access_requested_email('project', project_member.id, recipient.id) } subject { described_class.member_access_requested_email('project', project_member.id, recipient.id) }
it_behaves_like 'an email sent from GitLab' it_behaves_like 'an email sent from GitLab'
...@@ -750,6 +758,7 @@ describe Notify do ...@@ -750,6 +758,7 @@ describe Notify do
project.request_access(user) project.request_access(user)
project.requesters.find_by(user_id: user.id) project.requesters.find_by(user_id: user.id)
end end
subject { described_class.member_access_denied_email('project', project.id, user.id) } subject { described_class.member_access_denied_email('project', project.id, user.id) }
it_behaves_like 'an email sent from GitLab' it_behaves_like 'an email sent from GitLab'
...@@ -769,6 +778,7 @@ describe Notify do ...@@ -769,6 +778,7 @@ describe Notify do
let(:owner) { create(:user, name: "Chang O'Keefe") } let(:owner) { create(:user, name: "Chang O'Keefe") }
let(:project) { create(:project, :public, namespace: owner.namespace) } let(:project) { create(:project, :public, namespace: owner.namespace) }
let(:project_member) { create(:project_member, project: project, user: user) } let(:project_member) { create(:project_member, project: project, user: user) }
subject { described_class.member_access_granted_email('project', project_member.id) } subject { described_class.member_access_granted_email('project', project_member.id) }
it_behaves_like 'an email sent from GitLab' it_behaves_like 'an email sent from GitLab'
...@@ -1190,6 +1200,7 @@ describe Notify do ...@@ -1190,6 +1200,7 @@ describe Notify do
group.request_access(user) group.request_access(user)
group.requesters.find_by(user_id: user.id) group.requesters.find_by(user_id: user.id)
end end
subject { described_class.member_access_requested_email('group', group_member.id, recipient.id) } subject { described_class.member_access_requested_email('group', group_member.id, recipient.id) }
it_behaves_like 'an email sent from GitLab' it_behaves_like 'an email sent from GitLab'
...@@ -1216,6 +1227,7 @@ describe Notify do ...@@ -1216,6 +1227,7 @@ describe Notify do
group.requesters.find_by(user_id: user.id) group.requesters.find_by(user_id: user.id)
end end
let(:recipient) { user } let(:recipient) { user }
subject { described_class.member_access_denied_email('group', group.id, user.id) } subject { described_class.member_access_denied_email('group', group.id, user.id) }
it_behaves_like 'an email sent from GitLab' it_behaves_like 'an email sent from GitLab'
......
...@@ -307,6 +307,7 @@ describe ProjectPolicy do ...@@ -307,6 +307,7 @@ describe ProjectPolicy do
context 'for a guest in a private project' do context 'for a guest in a private project' do
let(:project) { create(:project, :private) } let(:project) { create(:project, :private) }
subject { described_class.new(guest, project) } subject { described_class.new(guest, project) }
it 'disallows the guest from reading the merge request and merge request iid' do it 'disallows the guest from reading the merge request and merge request iid' do
...@@ -320,6 +321,7 @@ describe ProjectPolicy do ...@@ -320,6 +321,7 @@ describe ProjectPolicy do
describe 'for unconfirmed user' do describe 'for unconfirmed user' do
let(:unconfirmed_user) { create(:user, confirmed_at: nil) } let(:unconfirmed_user) { create(:user, confirmed_at: nil) }
subject { described_class.new(unconfirmed_user, project) } subject { described_class.new(unconfirmed_user, project) }
it 'disallows to modify pipelines' do it 'disallows to modify pipelines' do
......
...@@ -41,6 +41,7 @@ describe LabelPresenter do ...@@ -41,6 +41,7 @@ describe LabelPresenter do
describe '#filter_path' do describe '#filter_path' do
context 'with group as context subject' do context 'with group as context subject' do
let(:label_in_group) { build_stubbed(:label, project: project).present(issuable_subject: group) } let(:label_in_group) { build_stubbed(:label, project: project).present(issuable_subject: group) }
subject { label_in_group.filter_path } subject { label_in_group.filter_path }
it { is_expected.to eq(issues_group_path(group, label_name: [label_in_group.title])) } it { is_expected.to eq(issues_group_path(group, label_name: [label_in_group.title])) }
......
...@@ -436,6 +436,7 @@ describe ProjectPresenter do ...@@ -436,6 +436,7 @@ describe ProjectPresenter do
describe '#repo_statistics_buttons' do describe '#repo_statistics_buttons' do
let(:presenter) { described_class.new(project, current_user: user) } let(:presenter) { described_class.new(project, current_user: user) }
subject(:empty_repo_statistics_buttons) { presenter.empty_repo_statistics_buttons } subject(:empty_repo_statistics_buttons) { presenter.empty_repo_statistics_buttons }
before do before do
......
...@@ -9,6 +9,7 @@ describe API::AwardEmoji do ...@@ -9,6 +9,7 @@ describe API::AwardEmoji do
set(:award_emoji) { create(:award_emoji, awardable: issue, user: user) } set(:award_emoji) { create(:award_emoji, awardable: issue, user: user) }
let!(:merge_request) { create(:merge_request, source_project: project, target_project: project) } let!(:merge_request) { create(:merge_request, source_project: project, target_project: project) }
let!(:downvote) { create(:award_emoji, :downvote, awardable: merge_request, user: user) } let!(:downvote) { create(:award_emoji, :downvote, awardable: merge_request, user: user) }
set(:note) { create(:note, project: project, noteable: issue) } set(:note) { create(:note, project: project, noteable: issue) }
before do before do
......
...@@ -69,6 +69,7 @@ describe API::Boards do ...@@ -69,6 +69,7 @@ describe API::Boards do
set(:group) { create(:group) } set(:group) { create(:group) }
set(:board_parent) { create(:group, parent: group ) } set(:board_parent) { create(:group, parent: group ) }
let(:url) { "/groups/#{board_parent.id}/boards/#{board.id}/lists" } let(:url) { "/groups/#{board_parent.id}/boards/#{board.id}/lists" }
set(:board) { create(:board, group: board_parent) } set(:board) { create(:board, group: board_parent) }
it 'creates a new board list for ancestor group labels' do it 'creates a new board list for ancestor group labels' do
......
...@@ -75,6 +75,7 @@ describe 'Adding an AwardEmoji' do ...@@ -75,6 +75,7 @@ describe 'Adding an AwardEmoji' do
describe 'marking Todos as done' do describe 'marking Todos as done' do
let(:user) { current_user} let(:user) { current_user}
subject { post_graphql_mutation(mutation, current_user: user) } subject { post_graphql_mutation(mutation, current_user: user) }
include_examples 'creating award emojis marks Todos as done' include_examples 'creating award emojis marks Todos as done'
......
...@@ -83,6 +83,7 @@ describe 'Toggling an AwardEmoji' do ...@@ -83,6 +83,7 @@ describe 'Toggling an AwardEmoji' do
describe 'marking Todos as done' do describe 'marking Todos as done' do
let(:user) { current_user} let(:user) { current_user}
subject { post_graphql_mutation(mutation, current_user: user) } subject { post_graphql_mutation(mutation, current_user: user) }
include_examples 'creating award emojis marks Todos as done' include_examples 'creating award emojis marks Todos as done'
......
...@@ -7,6 +7,7 @@ describe API::ProjectImport do ...@@ -7,6 +7,7 @@ describe API::ProjectImport do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:file) { File.join('spec', 'features', 'projects', 'import_export', 'test_project_export.tar.gz') } let(:file) { File.join('spec', 'features', 'projects', 'import_export', 'test_project_export.tar.gz') }
let(:namespace) { create(:group) } let(:namespace) { create(:group) }
before do before do
allow_any_instance_of(Gitlab::ImportExport).to receive(:storage_path).and_return(export_path) allow_any_instance_of(Gitlab::ImportExport).to receive(:storage_path).and_return(export_path)
stub_uploads_object_storage(FileUploader) stub_uploads_object_storage(FileUploader)
......
...@@ -1882,6 +1882,7 @@ describe API::Projects do ...@@ -1882,6 +1882,7 @@ describe API::Projects do
describe "POST /projects/:id/share" do describe "POST /projects/:id/share" do
let(:group) { create(:group) } let(:group) { create(:group) }
before do before do
group.add_developer(user) group.add_developer(user)
end end
......
...@@ -4,6 +4,7 @@ require 'spec_helper' ...@@ -4,6 +4,7 @@ require 'spec_helper'
describe API::Settings, 'Settings' do describe API::Settings, 'Settings' do
let(:user) { create(:user) } let(:user) { create(:user) }
set(:admin) { create(:admin) } set(:admin) { create(:admin) }
describe "GET /application/settings" do describe "GET /application/settings" do
......
...@@ -375,6 +375,7 @@ describe API::Snippets do ...@@ -375,6 +375,7 @@ describe API::Snippets do
describe 'DELETE /snippets/:id' do describe 'DELETE /snippets/:id' do
let!(:public_snippet) { create(:personal_snippet, :public, author: user) } let!(:public_snippet) { create(:personal_snippet, :public, author: user) }
it 'deletes snippet' do it 'deletes snippet' do
expect do expect do
delete api("/snippets/#{public_snippet.id}", user) delete api("/snippets/#{public_snippet.id}", user)
......
...@@ -2124,6 +2124,7 @@ describe API::Users do ...@@ -2124,6 +2124,7 @@ describe API::Users do
describe 'GET /user/status' do describe 'GET /user/status' do
let(:path) { '/user/status' } let(:path) { '/user/status' }
it_behaves_like 'rendering user status' it_behaves_like 'rendering user status'
end end
......
...@@ -5,6 +5,7 @@ require 'spec_helper' ...@@ -5,6 +5,7 @@ require 'spec_helper'
describe ClusterApplicationEntity do describe ClusterApplicationEntity do
describe '#as_json' do describe '#as_json' do
let(:application) { build(:clusters_applications_helm, version: '0.1.1') } let(:application) { build(:clusters_applications_helm, version: '0.1.1') }
subject { described_class.new(application).as_json } subject { described_class.new(application).as_json }
it 'has name' do it 'has name' do
......
...@@ -39,6 +39,7 @@ describe ClusterEntity do ...@@ -39,6 +39,7 @@ describe ClusterEntity do
context 'when no application has been installed' do context 'when no application has been installed' do
let(:cluster) { create(:cluster) } let(:cluster) { create(:cluster) }
subject { described_class.new(cluster).as_json[:applications]} subject { described_class.new(cluster).as_json[:applications]}
it 'contains helm as not_installable' do it 'contains helm as not_installable' do
......
...@@ -9,6 +9,7 @@ describe EnvironmentEntity do ...@@ -9,6 +9,7 @@ describe EnvironmentEntity do
end end
let(:environment) { create(:environment) } let(:environment) { create(:environment) }
subject { entity.as_json } subject { entity.as_json }
it 'exposes latest deployment' do it 'exposes latest deployment' do
......
...@@ -9,6 +9,7 @@ describe GroupChildEntity do ...@@ -9,6 +9,7 @@ describe GroupChildEntity do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:request) { double('request') } let(:request) { double('request') }
let(:entity) { described_class.new(object, request: request) } let(:entity) { described_class.new(object, request: request) }
subject(:json) { entity.as_json } subject(:json) { entity.as_json }
before do before do
......
...@@ -5,6 +5,7 @@ require 'spec_helper' ...@@ -5,6 +5,7 @@ require 'spec_helper'
describe GroupChildSerializer do describe GroupChildSerializer do
let(:request) { double('request') } let(:request) { double('request') }
let(:user) { create(:user) } let(:user) { create(:user) }
subject(:serializer) { described_class.new(current_user: user) } subject(:serializer) { described_class.new(current_user: user) }
describe '#represent' do describe '#represent' do
......
...@@ -10,6 +10,7 @@ describe NoteEntity do ...@@ -10,6 +10,7 @@ describe NoteEntity do
let(:entity) { described_class.new(note, request: request) } let(:entity) { described_class.new(note, request: request) }
let(:note) { create(:note) } let(:note) { create(:note) }
let(:user) { create(:user) } let(:user) { create(:user) }
subject { entity.as_json } subject { entity.as_json }
it_behaves_like 'note entity' it_behaves_like 'note entity'
......
...@@ -10,6 +10,7 @@ describe ProjectNoteEntity do ...@@ -10,6 +10,7 @@ describe ProjectNoteEntity do
let(:entity) { described_class.new(note, request: request) } let(:entity) { described_class.new(note, request: request) }
let(:note) { create(:note) } let(:note) { create(:note) }
let(:user) { create(:user) } let(:user) { create(:user) }
subject { entity.as_json } subject { entity.as_json }
it_behaves_like 'note entity' it_behaves_like 'note entity'
......
...@@ -7,6 +7,7 @@ describe UserEntity do ...@@ -7,6 +7,7 @@ describe UserEntity do
let(:entity) { described_class.new(user) } let(:entity) { described_class.new(user) }
let(:user) { create(:user) } let(:user) { create(:user) }
subject { entity.as_json } subject { entity.as_json }
it 'exposes user name and login' do it 'exposes user name and login' do
......
...@@ -152,6 +152,7 @@ end ...@@ -152,6 +152,7 @@ end
RSpec.shared_examples 'project policies as developer' do RSpec.shared_examples 'project policies as developer' do
context 'abilities for non-public projects' do context 'abilities for non-public projects' do
let(:project) { create(:project, namespace: owner.namespace) } let(:project) { create(:project, namespace: owner.namespace) }
subject { described_class.new(developer, project) } subject { described_class.new(developer, project) }
it do it do
......
...@@ -22,6 +22,7 @@ describe FileMover do ...@@ -22,6 +22,7 @@ describe FileMover do
end end
let(:file) { fixture_file_upload('spec/fixtures/banana_sample.gif') } let(:file) { fixture_file_upload('spec/fixtures/banana_sample.gif') }
subject { described_class.new(temp_file_path, from_model: user, to_model: snippet).execute } subject { described_class.new(temp_file_path, from_model: user, to_model: snippet).execute }
describe '#execute' do describe '#execute' do
......
...@@ -4,6 +4,7 @@ require 'spec_helper' ...@@ -4,6 +4,7 @@ require 'spec_helper'
describe AddressableUrlValidator do describe AddressableUrlValidator do
let!(:badge) { build(:badge, link_url: 'http://www.example.com') } let!(:badge) { build(:badge, link_url: 'http://www.example.com') }
subject { validator.validate(badge) } subject { validator.validate(badge) }
include_examples 'url validator examples', described_class::DEFAULT_OPTIONS[:schemes] include_examples 'url validator examples', described_class::DEFAULT_OPTIONS[:schemes]
......
...@@ -4,6 +4,7 @@ require 'spec_helper' ...@@ -4,6 +4,7 @@ require 'spec_helper'
describe DeviseEmailValidator do describe DeviseEmailValidator do
let!(:user) { build(:user, public_email: 'test@example.com') } let!(:user) { build(:user, public_email: 'test@example.com') }
subject { validator.validate(user) } subject { validator.validate(user) }
describe 'validations' do describe 'validations' do
......
...@@ -5,6 +5,7 @@ require 'spec_helper' ...@@ -5,6 +5,7 @@ require 'spec_helper'
describe ExpireJobCacheWorker do describe ExpireJobCacheWorker do
set(:pipeline) { create(:ci_empty_pipeline) } set(:pipeline) { create(:ci_empty_pipeline) }
let(:project) { pipeline.project } let(:project) { pipeline.project }
subject { described_class.new } subject { described_class.new }
describe '#perform' do describe '#perform' do
......
...@@ -6,6 +6,7 @@ describe ExpirePipelineCacheWorker do ...@@ -6,6 +6,7 @@ describe ExpirePipelineCacheWorker do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:project) } let(:project) { create(:project) }
let(:pipeline) { create(:ci_pipeline, project: project) } let(:pipeline) { create(:ci_pipeline, project: project) }
subject { described_class.new } subject { described_class.new }
describe '#perform' do describe '#perform' do
......
...@@ -5,6 +5,7 @@ require 'spec_helper' ...@@ -5,6 +5,7 @@ require 'spec_helper'
describe MailScheduler::NotificationServiceWorker do describe MailScheduler::NotificationServiceWorker do
let(:worker) { described_class.new } let(:worker) { described_class.new }
let(:method) { 'new_key' } let(:method) { 'new_key' }
set(:key) { create(:personal_key) } set(:key) { create(:personal_key) }
def serialize(*args) def serialize(*args)
......
...@@ -4,6 +4,7 @@ require 'spec_helper' ...@@ -4,6 +4,7 @@ require 'spec_helper'
describe RepositoryCheck::BatchWorker do describe RepositoryCheck::BatchWorker do
let(:shard_name) { 'default' } let(:shard_name) { 'default' }
subject { described_class.new } subject { described_class.new }
before do before do
......
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