Commit 14351e8f authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Merge branch 'replace-set-to_let_it_be-in-spec-requests' into 'master'

Replace set with let_it_be in spec/requests

See merge request gitlab-org/gitlab!24999
parents 0c739683 0f8bc3db
......@@ -3,12 +3,12 @@
require 'spec_helper'
describe API::AccessRequests do
set(:maintainer) { create(:user) }
set(:developer) { create(:user) }
set(:access_requester) { create(:user) }
set(:stranger) { create(:user) }
let_it_be(:maintainer) { create(:user) }
let_it_be(:developer) { create(:user) }
let_it_be(:access_requester) { create(:user) }
let_it_be(:stranger) { create(:user) }
set(:project) do
let_it_be(:project) do
create(:project, :public, creator_id: maintainer.id, namespace: maintainer.namespace) do |project|
project.add_developer(developer)
project.add_maintainer(maintainer)
......@@ -16,7 +16,7 @@ describe API::AccessRequests do
end
end
set(:group) do
let_it_be(:group) do
create(:group, :public) do |group|
group.add_developer(developer)
group.add_owner(maintainer)
......
......@@ -3,15 +3,14 @@
require 'spec_helper'
describe API::AwardEmoji do
set(:user) { create(:user) }
set(:project) { create(:project) }
set(:issue) { create(:issue, project: project) }
set(:award_emoji) { create(:award_emoji, awardable: issue, user: user) }
let_it_be(:user) { create(:user) }
let_it_be(:project) { create(:project) }
let_it_be(:issue) { create(:issue, project: project) }
let_it_be(:award_emoji) { create(:award_emoji, awardable: issue, user: user) }
let_it_be(:note) { create(:note, project: project, noteable: issue) }
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
project.add_maintainer(user)
end
......
......@@ -3,35 +3,35 @@
require 'spec_helper'
describe API::Boards do
set(:user) { create(:user) }
set(:non_member) { create(:user) }
set(:guest) { create(:user) }
set(:admin) { create(:user, :admin) }
set(:board_parent) { create(:project, :public, creator_id: user.id, namespace: user.namespace ) }
let_it_be(:user) { create(:user) }
let_it_be(:non_member) { create(:user) }
let_it_be(:guest) { create(:user) }
let_it_be(:admin) { create(:user, :admin) }
let_it_be(:board_parent, reload: true) { create(:project, :public, creator_id: user.id, namespace: user.namespace ) }
set(:dev_label) do
let_it_be(:dev_label) do
create(:label, title: 'Development', color: '#FFAABB', project: board_parent)
end
set(:test_label) do
let_it_be(:test_label) do
create(:label, title: 'Testing', color: '#FFAACC', project: board_parent)
end
set(:ux_label) do
let_it_be(:ux_label) do
create(:label, title: 'UX', color: '#FF0000', project: board_parent)
end
set(:dev_list) do
let_it_be(:dev_list) do
create(:list, label: dev_label, position: 1)
end
set(:test_list) do
let_it_be(:test_list) do
create(:list, label: test_label, position: 2)
end
set(:milestone) { create(:milestone, project: board_parent) }
set(:board_label) { create(:label, project: board_parent) }
set(:board) { create(:board, project: board_parent, lists: [dev_list, test_list]) }
let_it_be(:milestone) { create(:milestone, project: board_parent) }
let_it_be(:board_label) { create(:label, project: board_parent) }
let_it_be(:board) { create(:board, project: board_parent, lists: [dev_list, test_list]) }
it_behaves_like 'group and project boards', "/projects/:id/boards"
......@@ -66,11 +66,11 @@ describe API::Boards do
end
describe "POST /groups/:id/boards/lists" do
set(:group) { create(:group) }
set(:board_parent) { create(:group, parent: group ) }
let_it_be(:group) { create(:group) }
let_it_be(:board_parent) { create(:group, parent: group ) }
let(:url) { "/groups/#{board_parent.id}/boards/#{board.id}/lists" }
set(:board) { create(:board, group: board_parent) }
let_it_be(:board) { create(:board, group: board_parent) }
it 'creates a new board list for ancestor group labels' do
group.add_developer(user)
......
......@@ -3,7 +3,7 @@
require 'spec_helper'
describe API::Branches do
set(:user) { create(:user) }
let_it_be(:user) { create(:user) }
let(:project) { create(:project, :repository, creator: user, path: 'my.project') }
let(:guest) { create(:user).tap { |u| project.add_guest(u) } }
let(:branch_name) { 'feature' }
......
......@@ -3,9 +3,9 @@
require 'spec_helper'
describe API::BroadcastMessages do
set(:user) { create(:user) }
set(:admin) { create(:admin) }
set(:message) { create(:broadcast_message) }
let_it_be(:user) { create(:user) }
let_it_be(:admin) { create(:admin) }
let_it_be(:message) { create(:broadcast_message) }
describe 'GET /broadcast_messages' do
it 'returns an Array of BroadcastMessages' do
......
......@@ -3,8 +3,8 @@
require 'spec_helper'
describe API::Features do
set(:user) { create(:user) }
set(:admin) { create(:admin) }
let_it_be(:user) { create(:user) }
let_it_be(:admin) { create(:admin) }
before do
Flipper.unregister_groups
......
......@@ -16,7 +16,7 @@ describe 'getting project information' do
end
context 'when there is a current_user' do
set(:current_user) { create(:user) }
let_it_be(:current_user) { create(:user) }
it_behaves_like 'a working graphql query'
......
......@@ -5,7 +5,7 @@ require 'spec_helper'
describe 'GitlabSchema configurations' do
include GraphqlHelpers
set(:project) { create(:project) }
let_it_be(:project) { create(:project) }
shared_examples 'imposing query limits' do
describe 'timeouts' do
......
......@@ -5,9 +5,9 @@ require 'spec_helper'
describe 'Adding an AwardEmoji' do
include GraphqlHelpers
set(:current_user) { create(:user) }
set(:project) { create(:project) }
set(:awardable) { create(:note, project: project) }
let_it_be(:current_user) { create(:user) }
let_it_be(:project) { create(:project) }
let_it_be(:awardable) { create(:note, project: project) }
let(:emoji_name) { 'thumbsup' }
let(:mutation) do
variables = {
......
......@@ -5,9 +5,9 @@ require 'spec_helper'
describe 'Toggling an AwardEmoji' do
include GraphqlHelpers
set(:current_user) { create(:user) }
set(:project) { create(:project) }
set(:awardable) { create(:note, project: project) }
let_it_be(:current_user) { create(:user) }
let_it_be(:project, reload: true) { create(:project) }
let_it_be(:awardable) { create(:note, project: project) }
let(:emoji_name) { 'thumbsup' }
let(:mutation) do
variables = {
......
......@@ -5,7 +5,7 @@ require 'spec_helper'
describe 'Adding a DiffNote' do
include GraphqlHelpers
set(:current_user) { create(:user) }
let_it_be(:current_user) { create(:user) }
let(:noteable) { create(:merge_request, source_project: project, target_project: project) }
let(:project) { create(:project, :repository) }
let(:diff_refs) { noteable.diff_refs }
......
......@@ -5,7 +5,7 @@ require 'spec_helper'
describe 'Adding an image DiffNote' do
include GraphqlHelpers
set(:current_user) { create(:user) }
let_it_be(:current_user) { create(:user) }
let(:noteable) { create(:merge_request, source_project: project, target_project: project) }
let(:project) { create(:project, :repository) }
let(:diff_refs) { noteable.diff_refs }
......
......@@ -5,7 +5,7 @@ require 'spec_helper'
describe 'Adding a Note' do
include GraphqlHelpers
set(:current_user) { create(:user) }
let_it_be(:current_user) { create(:user) }
let(:noteable) { create(:merge_request, source_project: project, target_project: project) }
let(:project) { create(:project) }
let(:discussion) { nil }
......
......@@ -9,8 +9,8 @@ describe 'getting task completion status information' do
DESCRIPTION_1_DONE = '- [x] task 1\n- [ ] task 2'
DESCRIPTION_2_DONE = '- [x] task 1\n- [x] task 2'
set(:user1) { create(:user) }
set(:project) { create(:project, :repository, :public) }
let_it_be(:user1) { create(:user) }
let_it_be(:project) { create(:project, :repository, :public) }
let(:fields) do
<<~QUERY
......
......@@ -3,42 +3,42 @@
require 'spec_helper'
describe API::GroupBoards do
set(:user) { create(:user) }
set(:non_member) { create(:user) }
set(:guest) { create(:user) }
set(:admin) { create(:user, :admin) }
set(:board_parent) { create(:group, :public) }
let_it_be(:user) { create(:user) }
let_it_be(:non_member) { create(:user) }
let_it_be(:guest) { create(:user) }
let_it_be(:admin) { create(:user, :admin) }
let_it_be(:board_parent) { create(:group, :public) }
before do
board_parent.add_owner(user)
end
set(:project) { create(:project, :public, namespace: board_parent ) }
let_it_be(:project) { create(:project, :public, namespace: board_parent ) }
set(:dev_label) do
let_it_be(:dev_label) do
create(:group_label, title: 'Development', color: '#FFAABB', group: board_parent)
end
set(:test_label) do
let_it_be(:test_label) do
create(:group_label, title: 'Testing', color: '#FFAACC', group: board_parent)
end
set(:ux_label) do
let_it_be(:ux_label) do
create(:group_label, title: 'UX', color: '#FF0000', group: board_parent)
end
set(:dev_list) do
let_it_be(:dev_list) do
create(:list, label: dev_label, position: 1)
end
set(:test_list) do
let_it_be(:test_list) do
create(:list, label: test_label, position: 2)
end
set(:milestone) { create(:milestone, group: board_parent) }
set(:board_label) { create(:group_label, group: board_parent) }
let_it_be(:milestone) { create(:milestone, group: board_parent) }
let_it_be(:board_label) { create(:group_label, group: board_parent) }
set(:board) { create(:board, group: board_parent, lists: [dev_list, test_list]) }
let_it_be(:board) { create(:board, group: board_parent, lists: [dev_list, test_list]) }
it_behaves_like 'group and project boards', "/groups/:id/boards", false
......
......@@ -3,17 +3,15 @@
require 'spec_helper'
describe API::Issues do
set(:user) { create(:user) }
let_it_be(:user) { create(:user) }
let(:user2) { create(:user) }
let(:non_member) { create(:user) }
set(:guest) { create(:user) }
set(:author) { create(:author) }
set(:assignee) { create(:assignee) }
let_it_be(:guest) { create(:user) }
let_it_be(:author) { create(:author) }
let_it_be(:assignee) { create(:assignee) }
let(:admin) { create(:user, :admin) }
let(:issue_title) { 'foo' }
let(:issue_description) { 'closed' }
let(:no_milestone_title) { 'None' }
let(:any_milestone_title) { 'Any' }
......
......@@ -3,17 +3,17 @@
require 'spec_helper'
describe API::Issues do
set(:user) { create(:user) }
set(:project) { create(:project, :public, :repository, creator_id: user.id, namespace: user.namespace) }
set(:private_mrs_project) do
let_it_be(:user) { create(:user) }
let_it_be(:project, reload: true) { create(:project, :public, :repository, creator_id: user.id, namespace: user.namespace) }
let_it_be(:private_mrs_project) do
create(:project, :public, :repository, creator_id: user.id, namespace: user.namespace, merge_requests_access_level: ProjectFeature::PRIVATE)
end
let(:user2) { create(:user) }
let(:non_member) { create(:user) }
set(:guest) { create(:user) }
set(:author) { create(:author) }
set(:assignee) { create(:assignee) }
let_it_be(:guest) { create(:user) }
let_it_be(:author) { create(:author) }
let_it_be(:assignee) { create(:assignee) }
let(:admin) { create(:user, :admin) }
let(:issue_title) { 'foo' }
let(:issue_description) { 'closed' }
......@@ -48,12 +48,12 @@ describe API::Issues do
title: issue_title,
description: issue_description
end
set(:label) do
let_it_be(:label) do
create(:label, title: 'label', color: '#FFAABB', project: project)
end
let!(:label_link) { create(:label_link, label: label, target: issue) }
let(:milestone) { create(:milestone, title: '1.0.0', project: project) }
set(:empty_milestone) do
let_it_be(:empty_milestone) do
create(:milestone, title: '2.0.0', project: project)
end
let!(:note) { create(:note_on_issue, author: user, project: project, noteable: issue) }
......
......@@ -3,17 +3,17 @@
require 'spec_helper'
describe API::Issues do
set(:user) { create(:user) }
set(:project) { create(:project, :public, :repository, creator_id: user.id, namespace: user.namespace) }
set(:private_mrs_project) do
let_it_be(:user) { create(:user) }
let_it_be(:project, reload: true) { create(:project, :public, :repository, creator_id: user.id, namespace: user.namespace) }
let_it_be(:private_mrs_project) do
create(:project, :public, :repository, creator_id: user.id, namespace: user.namespace, merge_requests_access_level: ProjectFeature::PRIVATE)
end
let(:user2) { create(:user) }
let(:non_member) { create(:user) }
set(:guest) { create(:user) }
set(:author) { create(:author) }
set(:assignee) { create(:assignee) }
let_it_be(:guest) { create(:user) }
let_it_be(:author) { create(:author) }
let_it_be(:assignee) { create(:assignee) }
let(:admin) { create(:user, :admin) }
let(:issue_title) { 'foo' }
let(:issue_description) { 'closed' }
......@@ -48,12 +48,12 @@ describe API::Issues do
title: issue_title,
description: issue_description
end
set(:label) do
let_it_be(:label) do
create(:label, title: 'label', color: '#FFAABB', project: project)
end
let!(:label_link) { create(:label_link, label: label, target: issue) }
let(:milestone) { create(:milestone, title: '1.0.0', project: project) }
set(:empty_milestone) do
let_it_be(:empty_milestone) do
create(:milestone, title: '2.0.0', project: project)
end
let!(:note) { create(:note_on_issue, author: user, project: project, noteable: issue) }
......
......@@ -3,16 +3,16 @@
require 'spec_helper'
describe API::Issues do
set(:user) { create(:user) }
set(:project) do
let_it_be(:user) { create(:user) }
let_it_be(:project, reload: true) do
create(:project, :public, creator_id: user.id, namespace: user.namespace)
end
let(:user2) { create(:user) }
let(:non_member) { create(:user) }
set(:guest) { create(:user) }
set(:author) { create(:author) }
set(:assignee) { create(:assignee) }
let_it_be(:guest) { create(:user) }
let_it_be(:author) { create(:author) }
let_it_be(:assignee) { create(:assignee) }
let(:admin) { create(:user, :admin) }
let(:issue_title) { 'foo' }
let(:issue_description) { 'closed' }
......@@ -47,12 +47,12 @@ describe API::Issues do
title: issue_title,
description: issue_description
end
set(:label) do
let_it_be(:label) do
create(:label, title: 'label', color: '#FFAABB', project: project)
end
let!(:label_link) { create(:label_link, label: label, target: issue) }
let(:milestone) { create(:milestone, title: '1.0.0', project: project) }
set(:empty_milestone) do
let_it_be(:empty_milestone) do
create(:milestone, title: '2.0.0', project: project)
end
let!(:note) { create(:note_on_issue, author: user, project: project, noteable: issue) }
......
......@@ -3,16 +3,16 @@
require 'spec_helper'
describe API::Issues do
set(:user) { create(:user) }
set(:project) do
let_it_be(:user) { create(:user) }
let_it_be(:project, reload: true) do
create(:project, :public, creator_id: user.id, namespace: user.namespace)
end
let(:user2) { create(:user) }
let(:non_member) { create(:user) }
set(:guest) { create(:user) }
set(:author) { create(:author) }
set(:assignee) { create(:assignee) }
let_it_be(:guest) { create(:user) }
let_it_be(:author) { create(:author) }
let_it_be(:assignee) { create(:assignee) }
let(:admin) { create(:user, :admin) }
let(:issue_title) { 'foo' }
let(:issue_description) { 'closed' }
......@@ -47,12 +47,12 @@ describe API::Issues do
title: issue_title,
description: issue_description
end
set(:label) do
let_it_be(:label) do
create(:label, title: 'label', color: '#FFAABB', project: project)
end
let!(:label_link) { create(:label_link, label: label, target: issue) }
let(:milestone) { create(:milestone, title: '1.0.0', project: project) }
set(:empty_milestone) do
let_it_be(:empty_milestone) do
create(:milestone, title: '2.0.0', project: project)
end
let!(:note) { create(:note_on_issue, author: user, project: project, noteable: issue) }
......
......@@ -31,11 +31,11 @@ describe API::Jobs do
end
end
set(:project) do
let_it_be(:project, reload: true) do
create(:project, :repository, public_builds: false)
end
set(:pipeline) do
let_it_be(:pipeline, reload: true) do
create(:ci_empty_pipeline, project: project,
sha: project.commit.id,
ref: project.default_branch)
......
......@@ -52,8 +52,8 @@ describe API::Markdown do
end
context "when arguments are valid" do
set(:project) { create(:project) }
set(:issue) { create(:issue, project: project) }
let_it_be(:project) { create(:project) }
let_it_be(:issue) { create(:issue, project: project) }
let(:text) { ":tada: Hello world! :100: #{issue.to_reference}" }
context "when not using gfm" do
......
......@@ -6,9 +6,9 @@ describe API::MergeRequests do
include ProjectForksHelper
let(:base_time) { Time.now }
set(:user) { create(:user) }
set(:user2) { create(:user) }
set(:admin) { create(:user, :admin) }
let_it_be(:user) { create(:user) }
let_it_be(:user2) { create(:user) }
let_it_be(:admin) { create(:user, :admin) }
let(:project) { create(:project, :public, :repository, creator: user, namespace: user.namespace, only_allow_merge_if_pipeline_succeeds: false) }
let(:milestone) { create(:milestone, title: '1.0.0', project: project) }
let(:milestone1) { create(:milestone, title: '0.9', project: project) }
......
......@@ -6,16 +6,15 @@ describe "Internal Project Pages Access" do
using RSpec::Parameterized::TableSyntax
include AccessMatchers
set(:group) { create(:group) }
set(:project) { create(:project, :internal, pages_access_level: ProjectFeature::ENABLED, namespace: group) }
set(:admin) { create(:admin) }
set(:owner) { create(:user) }
set(:master) { create(:user) }
set(:developer) { create(:user) }
set(:reporter) { create(:user) }
set(:guest) { create(:user) }
set(:user) { create(:user) }
let_it_be(:group) { create(:group) }
let_it_be(:project, reload: true) { create(:project, :internal, pages_access_level: ProjectFeature::ENABLED, namespace: group) }
let_it_be(:admin) { create(:admin) }
let_it_be(:owner) { create(:user) }
let_it_be(:master) { create(:user) }
let_it_be(:developer) { create(:user) }
let_it_be(:reporter) { create(:user) }
let_it_be(:guest) { create(:user) }
let_it_be(:user) { create(:user) }
before do
allow(Gitlab.config.pages).to receive(:access_control).and_return(true)
......
......@@ -6,16 +6,15 @@ describe "Private Project Pages Access" do
using RSpec::Parameterized::TableSyntax
include AccessMatchers
set(:group) { create(:group) }
set(:project) { create(:project, :private, pages_access_level: ProjectFeature::ENABLED, namespace: group) }
set(:admin) { create(:admin) }
set(:owner) { create(:user) }
set(:master) { create(:user) }
set(:developer) { create(:user) }
set(:reporter) { create(:user) }
set(:guest) { create(:user) }
set(:user) { create(:user) }
let_it_be(:group) { create(:group) }
let_it_be(:project, reload: true) { create(:project, :private, pages_access_level: ProjectFeature::ENABLED, namespace: group) }
let_it_be(:admin) { create(:admin) }
let_it_be(:owner) { create(:user) }
let_it_be(:master) { create(:user) }
let_it_be(:developer) { create(:user) }
let_it_be(:reporter) { create(:user) }
let_it_be(:guest) { create(:user) }
let_it_be(:user) { create(:user) }
before do
allow(Gitlab.config.pages).to receive(:access_control).and_return(true)
......
......@@ -6,16 +6,15 @@ describe "Public Project Pages Access" do
using RSpec::Parameterized::TableSyntax
include AccessMatchers
set(:group) { create(:group) }
set(:project) { create(:project, :public, pages_access_level: ProjectFeature::ENABLED, namespace: group) }
set(:admin) { create(:admin) }
set(:owner) { create(:user) }
set(:master) { create(:user) }
set(:developer) { create(:user) }
set(:reporter) { create(:user) }
set(:guest) { create(:user) }
set(:user) { create(:user) }
let_it_be(:group) { create(:group) }
let_it_be(:project, reload: true) { create(:project, :public, pages_access_level: ProjectFeature::ENABLED, namespace: group) }
let_it_be(:admin) { create(:admin) }
let_it_be(:owner) { create(:user) }
let_it_be(:master) { create(:user) }
let_it_be(:developer) { create(:user) }
let_it_be(:reporter) { create(:user) }
let_it_be(:guest) { create(:user) }
let_it_be(:user) { create(:user) }
before do
allow(Gitlab.config.pages).to receive(:access_control).and_return(true)
......
......@@ -3,9 +3,9 @@
require 'spec_helper'
describe API::PipelineSchedules do
set(:developer) { create(:user) }
set(:user) { create(:user) }
set(:project) { create(:project, :repository, public_builds: false) }
let_it_be(:developer) { create(:user) }
let_it_be(:user) { create(:user) }
let_it_be(:project) { create(:project, :repository, public_builds: false) }
before do
project.add_developer(developer)
......@@ -375,7 +375,7 @@ describe API::PipelineSchedules do
describe 'POST /projects/:id/pipeline_schedules/:pipeline_schedule_id/variables' do
let(:params) { attributes_for(:ci_pipeline_schedule_variable) }
set(:pipeline_schedule) do
let_it_be(:pipeline_schedule) do
create(:ci_pipeline_schedule, project: project, owner: developer)
end
......@@ -432,7 +432,7 @@ describe API::PipelineSchedules do
end
describe 'PUT /projects/:id/pipeline_schedules/:pipeline_schedule_id/variables/:key' do
set(:pipeline_schedule) do
let_it_be(:pipeline_schedule) do
create(:ci_pipeline_schedule, project: project, owner: developer)
end
......@@ -472,7 +472,7 @@ describe API::PipelineSchedules do
describe 'DELETE /projects/:id/pipeline_schedules/:pipeline_schedule_id/variables/:key' do
let(:maintainer) { create(:user) }
set(:pipeline_schedule) do
let_it_be(:pipeline_schedule) do
create(:ci_pipeline_schedule, project: project, owner: developer)
end
......
......@@ -5,12 +5,11 @@ require 'spec_helper'
describe API::ProjectContainerRepositories do
include ExclusiveLeaseHelpers
set(:project) { create(:project, :private) }
set(:maintainer) { create(:user) }
set(:developer) { create(:user) }
set(:reporter) { create(:user) }
set(:guest) { create(:user) }
let_it_be(:project) { create(:project, :private) }
let_it_be(:maintainer) { create(:user) }
let_it_be(:developer) { create(:user) }
let_it_be(:reporter) { create(:user) }
let_it_be(:guest) { create(:user) }
let(:root_repository) { create(:container_repository, :root, project: project) }
let(:test_repository) { create(:container_repository, project: project) }
......
......@@ -3,13 +3,13 @@
require 'spec_helper'
describe API::ProjectExport, :clean_gitlab_redis_cache do
set(:project) { create(:project) }
set(:project_none) { create(:project) }
set(:project_started) { create(:project) }
let_it_be(:project) { create(:project) }
let_it_be(:project_none) { create(:project) }
let_it_be(:project_started) { create(:project) }
let(:project_finished) { create(:project, :with_export) }
let(:project_after_export) { create(:project, :with_export) }
set(:user) { create(:user) }
set(:admin) { create(:admin) }
let_it_be(:user) { create(:user) }
let_it_be(:admin) { create(:admin) }
let(:path) { "/projects/#{project.id}/export" }
let(:path_none) { "/projects/#{project_none.id}/export" }
......
......@@ -3,9 +3,9 @@
require 'spec_helper'
describe API::ProjectSnippets do
set(:project) { create(:project, :public) }
set(:user) { create(:user) }
set(:admin) { create(:admin) }
let_it_be(:project) { create(:project, :public) }
let_it_be(:user) { create(:user) }
let_it_be(:admin) { create(:admin) }
describe "GET /projects/:project_id/snippets/:id/user_agent_detail" do
let(:snippet) { create(:project_snippet, :public, project: project) }
......
......@@ -3,9 +3,9 @@
require 'spec_helper'
describe API::ResourceLabelEvents do
set(:user) { create(:user) }
set(:project) { create(:project, :public, namespace: user.namespace) }
set(:label) { create(:label, project: project) }
let_it_be(:user) { create(:user) }
let_it_be(:project, reload: true) { create(:project, :public, namespace: user.namespace) }
let_it_be(:label) { create(:label, project: project) }
before do
project.add_developer(user)
......
......@@ -557,7 +557,7 @@ describe API::Runners do
end
describe 'GET /runners/:id/jobs' do
set(:job_1) { create(:ci_build) }
let_it_be(:job_1) { create(:ci_build) }
let!(:job_2) { create(:ci_build, :running, runner: shared_runner, project: project) }
let!(:job_3) { create(:ci_build, :failed, runner: shared_runner, project: project) }
let!(:job_4) { create(:ci_build, :running, runner: project_runner, project: project) }
......
......@@ -3,10 +3,10 @@
require 'spec_helper'
describe API::Search do
set(:user) { create(:user) }
set(:group) { create(:group) }
set(:project) { create(:project, :wiki_repo, :public, name: 'awesome project', group: group) }
set(:repo_project) { create(:project, :public, :repository, group: group) }
let_it_be(:user) { create(:user) }
let_it_be(:group) { create(:group) }
let_it_be(:project, reload: true) { create(:project, :wiki_repo, :public, name: 'awesome project', group: group) }
let_it_be(:repo_project) { create(:project, :public, :repository, group: group) }
shared_examples 'response is correct' do |schema:, size: 1|
it { expect(response).to have_gitlab_http_status(200) }
......
......@@ -3,10 +3,10 @@
require "spec_helper"
describe API::Services do
set(:user) { create(:user) }
set(:user2) { create(:user) }
let_it_be(:user) { create(:user) }
let_it_be(:user2) { create(:user) }
set(:project) do
let_it_be(:project, reload: true) do
create(:project, creator_id: user.id, namespace: user.namespace)
end
......
......@@ -5,7 +5,7 @@ require 'spec_helper'
describe API::Settings, 'Settings' do
let(:user) { create(:user) }
set(:admin) { create(:admin) }
let_it_be(:admin) { create(:admin) }
describe "GET /application/settings" do
it "returns application settings" do
......
......@@ -89,8 +89,8 @@ describe API::Snippets do
end
describe 'GET /snippets/:id/raw' do
set(:author) { create(:user) }
set(:snippet) { create(:personal_snippet, :private, author: author) }
let_it_be(:author) { create(:user) }
let_it_be(:snippet) { create(:personal_snippet, :private, author: author) }
it 'requires authentication' do
get api("/snippets/#{snippet.id}", nil)
......@@ -137,10 +137,10 @@ describe API::Snippets do
end
describe 'GET /snippets/:id' do
set(:admin) { create(:user, :admin) }
set(:author) { create(:user) }
set(:private_snippet) { create(:personal_snippet, :private, author: author) }
set(:internal_snippet) { create(:personal_snippet, :internal, author: author) }
let_it_be(:admin) { create(:user, :admin) }
let_it_be(:author) { create(:user) }
let_it_be(:private_snippet) { create(:personal_snippet, :private, author: author) }
let_it_be(:internal_snippet) { create(:personal_snippet, :internal, author: author) }
it 'requires authentication' do
get api("/snippets/#{private_snippet.id}", nil)
......
......@@ -3,8 +3,8 @@
require 'spec_helper'
describe 'task completion status response' do
set(:user) { create(:user) }
set(:project) do
let_it_be(:user) { create(:user) }
let_it_be(:project) do
create(:project, :public, creator_id: user.id, namespace: user.namespace)
end
......
......@@ -3,8 +3,8 @@
require 'spec_helper'
describe API::Triggers do
set(:user) { create(:user) }
set(:user2) { create(:user) }
let_it_be(:user) { create(:user) }
let_it_be(:user2) { create(:user) }
let!(:trigger_token) { 'secure_token' }
let!(:trigger_token_2) { 'secure_token_2' }
......
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