Commit 0f8139f0 authored by Vitali Tatarintev's avatar Vitali Tatarintev Committed by Stan Hu

Replace set to let_it_be in ee/spec

Get rids of `set` in specs
parent 8408c1bf
......@@ -3,17 +3,17 @@
require 'spec_helper'
describe MergeRequests::ByApprovalsFinder do
set(:first_user) { create(:user) }
set(:second_user) { create(:user) }
let_it_be(:first_user) { create(:user) }
let_it_be(:second_user) { create(:user) }
let(:third_user) { create(:user) }
set(:merge_request_without_approvals) { create(:merge_request) }
set(:merge_request_with_first_user_approval) do
let_it_be(:merge_request_without_approvals) { create(:merge_request) }
let_it_be(:merge_request_with_first_user_approval) do
create(:merge_request).tap do |mr|
create(:approval, merge_request: mr, user: first_user)
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(:approval, merge_request: mr, user: first_user)
create(:approval, merge_request: mr, user: second_user)
......
......@@ -11,11 +11,11 @@ describe Resolvers::DesignManagement::DesignsResolver do
end
describe '#resolve' do
set(:issue) { create(:issue) }
set(:project) { issue.project }
set(:first_version) { create(:design_version) }
set(:first_design) { create(:design, issue: issue, versions: [first_version]) }
set(:current_user) { create(:user) }
let_it_be(:issue) { create(:issue) }
let_it_be(:project) { issue.project }
let_it_be(:first_version) { create(:design_version) }
let_it_be(:first_design) { create(:design, issue: issue, versions: [first_version]) }
let_it_be(:current_user) { create(:user) }
let(:gql_context) { { current_user: current_user } }
let(:args) { {} }
......
......@@ -7,7 +7,7 @@ describe Resolvers::DesignManagement::Version::DesignsAtVersionResolver do
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(:version) { third_version }
......
......@@ -5,12 +5,12 @@ require 'spec_helper'
describe Analytics::GroupActivityCalculator do
subject { described_class.new(group, current_user) }
set(:group) { create(:group) }
set(:current_user) { create(:user) }
set(:subgroup) { create(:group, parent: group) }
set(:project) { create(:project, group: subgroup) }
set(:secret_subgroup) { create(:group, parent: group) }
set(:secret_project) { create(:project, group: secret_subgroup) }
let_it_be(:group) { create(:group) }
let_it_be(:current_user) { create(:user) }
let_it_be(:subgroup) { create(:group, parent: group) }
let_it_be(:project) { create(:project, group: subgroup) }
let_it_be(:secret_subgroup) { create(:group, parent: group) }
let_it_be(:secret_project) { create(:project, group: secret_subgroup) }
before do
subgroup.add_developer(current_user)
......@@ -18,8 +18,8 @@ describe Analytics::GroupActivityCalculator do
end
context 'with issues' do
set(:recent_issue) { create(:issue, project: project) }
set(:old_issue) do
let_it_be(:recent_issue) { create(:issue, project: project) }
let_it_be(:old_issue) do
create(:issue,
project: project,
created_at: 100.days.ago)
......
......@@ -180,7 +180,7 @@ describe DesignManagement::Design do
end
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
# assert that we can establish visibility at any given version.
......
......@@ -11,8 +11,8 @@ RSpec.describe Geo::Fdw::Project, :geo, type: :model do
end
describe '.search' do
set(:test_project) { create(:project, description: 'kitten mittens') }
set(:project) { described_class.find(test_project.id) }
let_it_be(:test_project, refind: true) { create(:project, description: 'kitten mittens') }
let_it_be(:project) { described_class.find(test_project.id) }
it 'returns projects with a matching name' do
expect(described_class.search(project.name)).to eq([project])
......
......@@ -6,8 +6,8 @@ describe Geo::ProjectRegistry do
include ::EE::GeoHelpers
using RSpec::Parameterized::TableSyntax
set(:project) { create(:project, description: 'kitten mittens') }
set(:registry) { create(:geo_project_registry, project_id: project.id) }
let_it_be(:project, refind: true) { create(:project, description: 'kitten mittens') }
let_it_be(:registry, refind: true) { create(:geo_project_registry, project_id: project.id) }
subject { registry }
......
......@@ -8,16 +8,14 @@ describe API::GeoNodes, :request_store, :geo, :prometheus, api: true do
include_context 'custom session'
set(:primary) { create(:geo_node, :primary) }
set(:secondary) { create(:geo_node) }
set(:secondary_status) { create(:geo_node_status, :healthy, geo_node: secondary) }
let_it_be(:admin, refind: true) { create(:admin) }
let_it_be(:user, refind: true) { create(:user) }
let_it_be(:primary, refind: true) { create(:geo_node, :primary) }
let_it_be(:secondary, refind: true) { create(:geo_node) }
let_it_be(:secondary_status, refind: true) { create(:geo_node_status, :healthy, geo_node: secondary) }
let(:unexisting_node_id) { GeoNode.maximum(:id).to_i.succ }
let(:group_to_sync) { create(:group) }
set(:admin) { create(:admin) }
set(:user) { create(:user) }
describe 'POST /geo_nodes' do
it 'denies access if not admin' do
post api('/geo_nodes', user), params: {}
......
......@@ -5,14 +5,13 @@ require "spec_helper"
describe API::MergeRequests do
include ProjectForksHelper
set(:user) { create(:user) }
set(:user2) { create(:user) }
set(: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) }
set(:milestone1) { create(:milestone, title: '0.9', project: project) }
set(:label) { create(:label, title: 'label', color: '#FFAABB', project: project) }
set(:label2) { create(:label, title: 'a-test', color: '#FFFFFF', project: project) }
let_it_be(:user) { create(:user) }
let_it_be(:user2) { create(:user) }
let_it_be(:project) { create(:project, :public, :repository, creator: user, namespace: user.namespace, only_allow_merge_if_pipeline_succeeds: false) }
let_it_be(:milestone) { create(:milestone, title: '1.0.0', project: project) }
let_it_be(:milestone1) { create(:milestone, title: '0.9', project: project) }
let_it_be(:label) { create(:label, title: 'label', color: '#FFAABB', project: project) }
let_it_be(:label2) { create(:label, title: 'a-test', color: '#FFFFFF', project: project) }
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) }
......
......@@ -5,9 +5,9 @@ require 'spec_helper'
describe Metrics::Dashboard::CloneDashboardService, :use_clean_rails_memory_store_caching do
STAGES = ::Gitlab::Metrics::Dashboard::Stages
set(:user) { create(:user) }
set(:project) { create(:project, :repository) }
set(:environment) { create(:environment, project: project) }
let_it_be(:user) { create(:user) }
let_it_be(:project) { create(:project, :repository) }
let_it_be(:environment) { create(:environment, project: project) }
describe '#execute' do
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