Commit c4b22794 authored by Stan Hu's avatar Stan Hu

Merge branch 'replace-set-to-let_it_be-in-ee-specs' into 'master'

Replace set to let_it_be in ee/spec

See merge request gitlab-org/gitlab!27989
parents 8408c1bf f8cec9dc
...@@ -3,17 +3,17 @@ ...@@ -3,17 +3,17 @@
require 'spec_helper' require 'spec_helper'
describe MergeRequests::ByApprovalsFinder do describe MergeRequests::ByApprovalsFinder do
set(:first_user) { create(:user) } let_it_be(:first_user) { create(:user) }
set(:second_user) { create(:user) } let_it_be(:second_user) { create(:user) }
let(:third_user) { create(:user) } let(:third_user) { create(:user) }
set(:merge_request_without_approvals) { create(:merge_request) } let_it_be(:merge_request_without_approvals) { create(:merge_request) }
set(:merge_request_with_first_user_approval) do let_it_be(:merge_request_with_first_user_approval) do
create(:merge_request).tap do |mr| create(:merge_request).tap do |mr|
create(:approval, merge_request: mr, user: first_user) create(:approval, merge_request: mr, user: first_user)
end end
end end
set(:merge_request_with_both_approvals) do let_it_be(:merge_request_with_both_approvals) do
create(:merge_request).tap do |mr| create(:merge_request).tap do |mr|
create(:approval, merge_request: mr, user: first_user) create(:approval, merge_request: mr, user: first_user)
create(:approval, merge_request: mr, user: second_user) create(:approval, merge_request: mr, user: second_user)
......
...@@ -11,11 +11,11 @@ describe Resolvers::DesignManagement::DesignsResolver do ...@@ -11,11 +11,11 @@ describe Resolvers::DesignManagement::DesignsResolver 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) }
let(:gql_context) { { current_user: current_user } } let(:gql_context) { { current_user: current_user } }
let(:args) { {} } let(:args) { {} }
......
...@@ -7,7 +7,7 @@ describe Resolvers::DesignManagement::Version::DesignsAtVersionResolver do ...@@ -7,7 +7,7 @@ describe Resolvers::DesignManagement::Version::DesignsAtVersionResolver do
include_context 'four designs in three versions' include_context 'four designs in three versions'
set(:current_user) { authorized_user } let_it_be(:current_user) { authorized_user }
let(:gql_context) { { current_user: current_user } } let(:gql_context) { { current_user: current_user } }
let(:version) { third_version } let(:version) { third_version }
......
...@@ -5,12 +5,12 @@ require 'spec_helper' ...@@ -5,12 +5,12 @@ require 'spec_helper'
describe Analytics::GroupActivityCalculator do describe Analytics::GroupActivityCalculator do
subject { described_class.new(group, current_user) } subject { described_class.new(group, current_user) }
set(:group) { create(:group) } let_it_be(:group) { create(:group) }
set(:current_user) { create(:user) } let_it_be(:current_user) { create(:user) }
set(:subgroup) { create(:group, parent: group) } let_it_be(:subgroup) { create(:group, parent: group) }
set(:project) { create(:project, group: subgroup) } let_it_be(:project) { create(:project, group: subgroup) }
set(:secret_subgroup) { create(:group, parent: group) } let_it_be(:secret_subgroup) { create(:group, parent: group) }
set(:secret_project) { create(:project, group: secret_subgroup) } let_it_be(:secret_project) { create(:project, group: secret_subgroup) }
before do before do
subgroup.add_developer(current_user) subgroup.add_developer(current_user)
...@@ -18,8 +18,8 @@ describe Analytics::GroupActivityCalculator do ...@@ -18,8 +18,8 @@ describe Analytics::GroupActivityCalculator do
end end
context 'with issues' do context 'with issues' do
set(:recent_issue) { create(:issue, project: project) } let_it_be(:recent_issue) { create(:issue, project: project) }
set(:old_issue) do let_it_be(:old_issue) do
create(:issue, create(:issue,
project: project, project: project,
created_at: 100.days.ago) created_at: 100.days.ago)
......
...@@ -180,7 +180,7 @@ describe DesignManagement::Design do ...@@ -180,7 +180,7 @@ describe DesignManagement::Design do
end end
describe '#visible_in?' do describe '#visible_in?' do
set(:issue) { create(:issue) } let_it_be(:issue) { create(:issue) }
# It is expensive to re-create complex histories, so we do it once, and then # It is expensive to re-create complex histories, so we do it once, and then
# assert that we can establish visibility at any given version. # assert that we can establish visibility at any given version.
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
require 'spec_helper' require 'spec_helper'
RSpec.describe Geo::Fdw::Project, :geo, type: :model do RSpec.describe Geo::Fdw::Project, :geo_fdw, type: :model do
context 'relationships' do context 'relationships' do
it { is_expected.to have_many(:job_artifacts).class_name('Geo::Fdw::Ci::JobArtifact') } it { is_expected.to have_many(:job_artifacts).class_name('Geo::Fdw::Ci::JobArtifact') }
it { is_expected.to have_many(:lfs_objects_projects).class_name('Geo::Fdw::LfsObjectsProject') } it { is_expected.to have_many(:lfs_objects_projects).class_name('Geo::Fdw::LfsObjectsProject') }
...@@ -11,8 +11,8 @@ RSpec.describe Geo::Fdw::Project, :geo, type: :model do ...@@ -11,8 +11,8 @@ RSpec.describe Geo::Fdw::Project, :geo, type: :model do
end end
describe '.search' do describe '.search' do
set(:test_project) { create(:project, description: 'kitten mittens') } let(:test_project) { create(:project, description: 'kitten mittens') }
set(:project) { described_class.find(test_project.id) } let(:project) { described_class.find(test_project.id) }
it 'returns projects with a matching name' do it 'returns projects with a matching name' do
expect(described_class.search(project.name)).to eq([project]) expect(described_class.search(project.name)).to eq([project])
......
...@@ -2,12 +2,12 @@ ...@@ -2,12 +2,12 @@
require 'spec_helper' require 'spec_helper'
describe Geo::ProjectRegistry do describe Geo::ProjectRegistry, :geo_fdw do
include ::EE::GeoHelpers include ::EE::GeoHelpers
using RSpec::Parameterized::TableSyntax using RSpec::Parameterized::TableSyntax
set(:project) { create(:project, description: 'kitten mittens') } let(:project) { create(:project, description: 'kitten mittens') }
set(:registry) { create(:geo_project_registry, project_id: project.id) } let(:registry) { create(:geo_project_registry, project_id: project.id) }
subject { registry } subject { registry }
......
...@@ -2,22 +2,20 @@ ...@@ -2,22 +2,20 @@
require 'spec_helper' require 'spec_helper'
describe API::GeoNodes, :request_store, :geo, :prometheus, api: true do describe API::GeoNodes, :request_store, :geo_fdw, :prometheus, api: true do
include ApiHelpers include ApiHelpers
include ::EE::GeoHelpers include ::EE::GeoHelpers
include_context 'custom session' include_context 'custom session'
set(:primary) { create(:geo_node, :primary) } let!(:admin) { create(:admin) }
set(:secondary) { create(:geo_node) } let!(:user) { create(:user) }
set(:secondary_status) { create(:geo_node_status, :healthy, geo_node: secondary) } let!(:primary) { create(:geo_node, :primary) }
let!(:secondary) { create(:geo_node) }
let!(:secondary_status) { create(:geo_node_status, :healthy, geo_node: secondary) }
let(:unexisting_node_id) { GeoNode.maximum(:id).to_i.succ } let(:unexisting_node_id) { GeoNode.maximum(:id).to_i.succ }
let(:group_to_sync) { create(:group) } let(:group_to_sync) { create(:group) }
set(:admin) { create(:admin) }
set(:user) { create(:user) }
describe 'POST /geo_nodes' do describe 'POST /geo_nodes' do
it 'denies access if not admin' do it 'denies access if not admin' do
post api('/geo_nodes', user), params: {} post api('/geo_nodes', user), params: {}
......
...@@ -5,16 +5,15 @@ require "spec_helper" ...@@ -5,16 +5,15 @@ require "spec_helper"
describe API::MergeRequests do describe API::MergeRequests do
include ProjectForksHelper include ProjectForksHelper
set(:user) { create(:user) } let_it_be(:user) { create(:user) }
set(:user2) { create(:user) } let_it_be(:user2) { create(:user) }
set(:project) { create(:project, :public, :repository, creator: user, namespace: user.namespace, only_allow_merge_if_pipeline_succeeds: false) } let_it_be(:project) { create(:project, :public, :repository, creator: user, namespace: user.namespace, only_allow_merge_if_pipeline_succeeds: false) }
set(:milestone) { create(:milestone, title: '1.0.0', project: project) } let_it_be(:milestone) { create(:milestone, title: '1.0.0', project: project) }
set(:milestone1) { create(:milestone, title: '0.9', project: project) } let_it_be(:milestone1) { create(:milestone, title: '0.9', project: project) }
set(:label) { create(:label, title: 'label', color: '#FFAABB', project: project) } let_it_be(:label) { create(:label, title: 'label', color: '#FFAABB', project: project) }
set(:label2) { create(:label, title: 'a-test', color: '#FFFFFF', project: project) } let_it_be(:label2) { create(:label, title: 'a-test', color: '#FFFFFF', project: project) }
let(:base_time) { Time.now }
let(:base_time) { Time.now } let!(:merge_request) { create(:merge_request, :simple, milestone: milestone1, author: user, assignees: [user, user2], source_project: project, target_project: project, title: "Test", created_at: base_time) }
let!(:merge_request) { create(:merge_request, :simple, milestone: milestone1, author: user, assignees: [user, user2], source_project: project, target_project: project, title: "Test", created_at: base_time) }
before do before do
project.add_reporter(user) project.add_reporter(user)
......
...@@ -5,9 +5,9 @@ require 'spec_helper' ...@@ -5,9 +5,9 @@ require 'spec_helper'
describe Metrics::Dashboard::CloneDashboardService, :use_clean_rails_memory_store_caching do describe Metrics::Dashboard::CloneDashboardService, :use_clean_rails_memory_store_caching do
STAGES = ::Gitlab::Metrics::Dashboard::Stages STAGES = ::Gitlab::Metrics::Dashboard::Stages
set(:user) { create(:user) } let_it_be(:user) { create(:user) }
set(:project) { create(:project, :repository) } let_it_be(:project) { create(:project, :repository) }
set(:environment) { create(:environment, project: project) } let_it_be(:environment) { create(:environment, project: project) }
describe '#execute' do describe '#execute' do
subject(:service_call) { described_class.new(project, user, params).execute } subject(:service_call) { described_class.new(project, user, params).execute }
......
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