Commit 33483d1d authored by James Fargher's avatar James Fargher

Automatically fixed EmptyLineAfterFinalLet in remaining directories

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