Commit ee4bfa00 authored by Thong Kuah's avatar Thong Kuah

Merge branch 'replace-set-with-let-it-be-in-ee-specs-batch-1' into 'master'

Replace set with let_it_be in EE specs

See merge request gitlab-org/gitlab!22794
parents 5aaa2f4c c0e01aab
...@@ -11,11 +11,11 @@ describe Resolvers::DesignManagement::DesignResolver do ...@@ -11,11 +11,11 @@ describe Resolvers::DesignManagement::DesignResolver do
end end
describe "#resolve" do describe "#resolve" do
set(:issue) { create(:issue) } let_it_be(:issue) { create(:issue) }
set(:project) { issue.project } let_it_be(:project) { issue.project }
set(:first_version) { create(:design_version) } let_it_be(:first_version) { create(:design_version) }
set(:first_design) { create(:design, issue: issue, versions: [first_version]) } let_it_be(:first_design) { create(:design, issue: issue, versions: [first_version]) }
set(:current_user) { create(:user) } let_it_be(:current_user) { create(:user) }
before do before do
project.add_developer(current_user) project.add_developer(current_user)
......
...@@ -11,10 +11,10 @@ describe Resolvers::DesignManagement::VersionResolver do ...@@ -11,10 +11,10 @@ describe Resolvers::DesignManagement::VersionResolver do
end end
describe "#resolve" do describe "#resolve" do
set(:issue) { create(:issue) } let_it_be(:issue) { create(:issue) }
set(:project) { issue.project } let_it_be(:project) { issue.project }
set(:first_version) { create(:design_version) } let_it_be(:first_version) { create(:design_version) }
set(:first_design) { create(:design, issue: issue, versions: [first_version]) } let_it_be(:first_design) { create(:design, issue: issue, versions: [first_version]) }
let(:current_user) { create(:user) } let(:current_user) { create(:user) }
before do before do
......
...@@ -5,8 +5,8 @@ require 'spec_helper' ...@@ -5,8 +5,8 @@ require 'spec_helper'
describe Resolvers::EpicResolver do describe Resolvers::EpicResolver do
include GraphqlHelpers include GraphqlHelpers
set(:current_user) { create(:user) } let_it_be(:current_user) { create(:user) }
set(:user2) { create(:user) } let_it_be(:user2) { create(:user) }
context "with a group" do context "with a group" do
let(:group) { create(:group) } let(:group) { create(:group) }
......
...@@ -6,9 +6,9 @@ describe EE::GitlabRoutingHelper do ...@@ -6,9 +6,9 @@ describe EE::GitlabRoutingHelper do
include ProjectsHelper include ProjectsHelper
include ApplicationSettingsHelper include ApplicationSettingsHelper
set(:primary) { create(:geo_node, :primary, url: 'http://localhost:123/relative', clone_url_prefix: 'git@localhost:') } let_it_be(:primary, reload: true) { create(:geo_node, :primary, url: 'http://localhost:123/relative', clone_url_prefix: 'git@localhost:') }
set(:group) { create(:group, path: 'foo') } let_it_be(:group, reload: true) { create(:group, path: 'foo') }
set(:project) { create(:project, namespace: group, path: 'bar') } let_it_be(:project, reload: true) { create(:project, namespace: group, path: 'bar') }
describe '#geo_primary_web_url' do describe '#geo_primary_web_url' do
before do before do
......
...@@ -13,7 +13,7 @@ describe EE::ServicesHelper do ...@@ -13,7 +13,7 @@ describe EE::ServicesHelper do
end end
end end
set(:project) { create(:project) } let_it_be(:project) { create(:project) }
subject { controller_class.new } subject { controller_class.new }
......
...@@ -3,16 +3,16 @@ ...@@ -3,16 +3,16 @@
require 'spec_helper' require 'spec_helper'
describe ::TodosHelper do describe ::TodosHelper do
set(:user) { create(:user) } let_it_be(:user) { create(:user) }
set(:author) { create(:user) } let_it_be(:author) { create(:user) }
set(:issue) { create(:issue) } let_it_be(:issue) { create(:issue) }
set(:design) { create(:design, issue: issue) } let_it_be(:design) { create(:design, issue: issue) }
set(:note) do let_it_be(:note) do
create(:note, create(:note,
project: issue.project, project: issue.project,
note: "I am note, hear me roar") note: "I am note, hear me roar")
end end
set(:design_todo) do let_it_be(:design_todo) do
create(:todo, :mentioned, create(:todo, :mentioned,
user: user, user: user,
project: issue.project, project: issue.project,
......
...@@ -173,8 +173,8 @@ describe EE::UserCalloutsHelper do ...@@ -173,8 +173,8 @@ describe EE::UserCalloutsHelper do
describe '#render_dashboard_gold_trial' do describe '#render_dashboard_gold_trial' do
using RSpec::Parameterized::TableSyntax using RSpec::Parameterized::TableSyntax
set(:namespace) { create(:namespace) } let_it_be(:namespace) { create(:namespace) }
set(:gold_plan) { create(:gold_plan) } let_it_be(:gold_plan) { create(:gold_plan) }
let(:user) { namespace.owner } let(:user) { namespace.owner }
where(:has_some_namespaces_with_no_trials?, :show_gold_trial?, :user_default_dashboard?, :has_no_trial_or_gold_plan?, :should_render?) do where(:has_some_namespaces_with_no_trials?, :show_gold_trial?, :user_default_dashboard?, :has_no_trial_or_gold_plan?, :should_render?) do
...@@ -220,9 +220,9 @@ describe EE::UserCalloutsHelper do ...@@ -220,9 +220,9 @@ describe EE::UserCalloutsHelper do
using RSpec::Parameterized::TableSyntax using RSpec::Parameterized::TableSyntax
let(:namespace) { create(:namespace) } let(:namespace) { create(:namespace) }
set(:free_plan) { create(:free_plan) } let_it_be(:free_plan) { create(:free_plan) }
set(:silver_plan) { create(:silver_plan) } let_it_be(:silver_plan) { create(:silver_plan) }
set(:gold_plan) { create(:gold_plan) } let_it_be(:gold_plan) { create(:gold_plan) }
let(:user) { namespace.owner } let(:user) { namespace.owner }
let(:gitlab_subscription) { create(:gitlab_subscription, namespace: namespace) } let(:gitlab_subscription) { create(:gitlab_subscription, namespace: namespace) }
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
require 'spec_helper' require 'spec_helper'
describe FeatureFlagsHelper do describe FeatureFlagsHelper do
set(:project) { create(:project) } let_it_be(:project) { create(:project) }
context '#unleash_api_url' do context '#unleash_api_url' do
subject { helper.unleash_api_url(project) } subject { helper.unleash_api_url(project) }
......
...@@ -13,7 +13,7 @@ describe EE::Emails::Projects do ...@@ -13,7 +13,7 @@ describe EE::Emails::Projects do
end end
end end
set(:user) { create(:user) } let_it_be(:user) { create(:user) }
describe '#prometheus_alert_fired_email' do describe '#prometheus_alert_fired_email' do
subject do subject do
......
...@@ -11,12 +11,12 @@ describe Notify do ...@@ -11,12 +11,12 @@ describe Notify do
include_context 'gitlab email notification' include_context 'gitlab email notification'
set(:user) { create(:user) } let_it_be(:user) { create(:user) }
set(:current_user) { create(:user, email: "current@email.com") } let_it_be(:current_user) { create(:user, email: "current@email.com") }
set(:assignee) { create(:user, email: 'assignee@example.com', name: 'John Doe') } let_it_be(:assignee) { create(:user, email: 'assignee@example.com', name: 'John Doe') }
set(:assignee2) { create(:user, email: 'assignee2@example.com', name: 'Jane Doe') } let_it_be(:assignee2) { create(:user, email: 'assignee2@example.com', name: 'Jane Doe') }
set(:merge_request) do let_it_be(:merge_request, reload: true) do
create(:merge_request, source_project: project, create(:merge_request, source_project: project,
target_project: project, target_project: project,
author: current_user, author: current_user,
...@@ -24,24 +24,24 @@ describe Notify do ...@@ -24,24 +24,24 @@ describe Notify do
description: 'Awesome description') description: 'Awesome description')
end end
set(:issue) do let_it_be(:issue, reload: true) do
create(:issue, author: current_user, create(:issue, author: current_user,
assignees: [assignee], assignees: [assignee],
project: project, project: project,
description: 'My awesome description!') description: 'My awesome description!')
end end
set(:project2) { create(:project, :repository) } let_it_be(:project2, reload: true) { create(:project, :repository) }
set(:merge_request_without_assignee) do let_it_be(:merge_request_without_assignee, reload: true) do
create(:merge_request, source_project: project2, create(:merge_request, source_project: project2,
author: current_user, author: current_user,
description: 'Awesome description') description: 'Awesome description')
end end
describe '.note_design_email' do describe '.note_design_email' do
set(:design) { create(:design, :with_file) } let_it_be(:design) { create(:design, :with_file) }
set(:recipient) { create(:user) } let_it_be(:recipient) { create(:user) }
set(:note) do let_it_be(:note) do
create(:diff_note_on_design, create(:diff_note_on_design,
noteable: design, noteable: design,
project: design.project, project: design.project,
...@@ -112,7 +112,7 @@ describe Notify do ...@@ -112,7 +112,7 @@ describe Notify do
end end
describe 'new note email' do describe 'new note email' do
set(:first_note) { create(:discussion_note_on_issue, note: 'Hello world') } let_it_be(:first_note) { create(:discussion_note_on_issue, note: 'Hello world') }
subject { described_class.service_desk_new_note_email(issue.id, first_note.id) } subject { described_class.service_desk_new_note_email(issue.id, first_note.id) }
...@@ -287,8 +287,8 @@ describe Notify do ...@@ -287,8 +287,8 @@ describe Notify do
context 'for a group' do context 'for a group' do
describe 'for epics' do describe 'for epics' do
set(:group) { create(:group) } let_it_be(:group) { create(:group) }
set(:epic) { create(:epic, group: group) } let_it_be(:epic) { create(:epic, group: group) }
context 'that are new' do context 'that are new' do
subject { described_class.new_epic_email(recipient.id, epic.id) } subject { described_class.new_epic_email(recipient.id, epic.id) }
...@@ -319,7 +319,7 @@ describe Notify do ...@@ -319,7 +319,7 @@ describe Notify do
end end
context 'for epic notes' do context 'for epic notes' do
set(:note) { create(:note, project: nil, noteable: epic) } let_it_be(:note) { create(:note, project: nil, noteable: epic) }
let(:note_author) { note.author } let(:note_author) { note.author }
let(:epic_note_path) { group_epic_path(group, epic, anchor: "note_#{note.id}") } let(:epic_note_path) { group_epic_path(group, epic, anchor: "note_#{note.id}") }
......
...@@ -35,7 +35,7 @@ describe Ci::BuildPolicy do ...@@ -35,7 +35,7 @@ describe Ci::BuildPolicy do
describe 'manage a web ide terminal' do describe 'manage a web ide terminal' do
let(:build_permissions) { %i[read_web_ide_terminal create_build_terminal update_web_ide_terminal create_build_service_proxy] } let(:build_permissions) { %i[read_web_ide_terminal create_build_terminal update_web_ide_terminal create_build_service_proxy] }
set(:maintainer) { create(:user) } let_it_be(:maintainer) { create(:user) }
let(:owner) { create(:owner) } let(:owner) { create(:owner) }
let(:admin) { create(:admin) } let(:admin) { create(:admin) }
let(:maintainer) { create(:user) } let(:maintainer) { create(:user) }
......
...@@ -5,12 +5,12 @@ require 'spec_helper' ...@@ -5,12 +5,12 @@ require 'spec_helper'
describe ProjectPolicy do describe ProjectPolicy do
include ExternalAuthorizationServiceHelpers include ExternalAuthorizationServiceHelpers
set(:owner) { create(:user) } let_it_be(:owner) { create(:user) }
set(:admin) { create(:admin) } let_it_be(:admin) { create(:admin) }
set(:maintainer) { create(:user) } let_it_be(:maintainer) { create(:user) }
set(:developer) { create(:user) } let_it_be(:developer) { create(:user) }
set(:reporter) { create(:user) } let_it_be(:reporter) { create(:user) }
set(:guest) { create(:user) } let_it_be(:guest) { create(:user) }
let(:project) { create(:project, :public, namespace: owner.namespace) } let(:project) { create(:project, :public, namespace: owner.namespace) }
subject { described_class.new(current_user, project) } subject { described_class.new(current_user, project) }
......
...@@ -3,17 +3,17 @@ ...@@ -3,17 +3,17 @@
require 'spec_helper' require 'spec_helper'
describe ApprovalRulePresenter do describe ApprovalRulePresenter do
set(:user) { create(:user) } let_it_be(:user) { create(:user) }
set(:public_group) { create(:group) } let_it_be(:public_group) { create(:group) }
set(:private_group) { create(:group, :private) } let_it_be(:private_group) { create(:group, :private) }
let(:groups) { [public_group, private_group] } let(:groups) { [public_group, private_group] }
subject(:presenter) { described_class.new(rule, current_user: user) } subject(:presenter) { described_class.new(rule, current_user: user) }
describe '#approvers' do describe '#approvers' do
set(:private_member) { create(:group_member, group: private_group) } let_it_be(:private_member) { create(:group_member, group: private_group) }
set(:public_member) { create(:group_member, group: public_group) } let_it_be(:public_member) { create(:group_member, group: public_group) }
set(:rule) { create(:approval_merge_request_rule, groups: [public_group, private_group]) } let_it_be(:rule) { create(:approval_merge_request_rule, groups: [public_group, private_group]) }
subject { presenter.approvers } subject { presenter.approvers }
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
require 'spec_helper' require 'spec_helper'
describe Ci::PipelinePresenter do describe Ci::PipelinePresenter do
set(:project) { create(:project) } let_it_be(:project, reload: true) { create(:project) }
set(:pipeline) { create(:ci_pipeline, project: project) } let_it_be(:pipeline, reload: true) { create(:ci_pipeline, project: project) }
subject(:presenter) do subject(:presenter) do
described_class.new(pipeline) described_class.new(pipeline)
......
...@@ -5,7 +5,7 @@ require 'spec_helper' ...@@ -5,7 +5,7 @@ require 'spec_helper'
describe GroupClusterablePresenter do describe GroupClusterablePresenter do
include Gitlab::Routing.url_helpers include Gitlab::Routing.url_helpers
set(:user) { create(:user) } let_it_be(:user) { create(:user) }
let(:presenter) { described_class.new(group) } let(:presenter) { described_class.new(group) }
let(:cluster) { create(:cluster, :provided_by_gcp, :group) } let(:cluster) { create(:cluster, :provided_by_gcp, :group) }
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
require 'spec_helper' require 'spec_helper'
describe Projects::Prometheus::AlertPresenter do describe Projects::Prometheus::AlertPresenter do
set(:project) { create(:project) } let_it_be(:project) { create(:project) }
let(:presenter) { described_class.new(alert) } let(:presenter) { described_class.new(alert) }
let(:payload) { {} } let(:payload) { {} }
......
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