Commit c76ad7e8 authored by Robert Speicher's avatar Robert Speicher

Merge branch 'replace-set-with-let-it-be-in-ee-spec-controllers' into 'master'

Replace set to let_it_be in ee/spec/controllers

See merge request gitlab-org/gitlab!22775
parents 0137d0ae bdc4f70e
......@@ -5,7 +5,7 @@ require 'spec_helper'
describe Admin::Geo::ProjectsController, :geo do
include EE::GeoHelpers
set(:admin) { create(:admin) }
let_it_be(:admin) { create(:admin) }
let(:synced_registry) { create(:geo_project_registry, :synced) }
before do
......
......@@ -6,7 +6,7 @@ describe Admin::Geo::SettingsController, :geo do
include EE::GeoHelpers
include StubENV
set(:admin) { create(:admin) }
let_it_be(:admin) { create(:admin) }
before do
stub_env('IN_MEMORY_APPLICATION_SETTINGS', 'false')
......
......@@ -5,11 +5,11 @@ require 'spec_helper'
describe Admin::Geo::UploadsController, :geo do
include EE::GeoHelpers
set(:admin) { create(:admin) }
set(:secondary) { create(:geo_node) }
set(:synced_registry) { create(:geo_upload_registry, :with_file, :attachment, success: true) }
set(:failed_registry) { create(:geo_upload_registry, :failed) }
set(:never_registry) { create(:geo_upload_registry, :failed, retry_count: nil) }
let_it_be(:admin) { create(:admin) }
let_it_be(:secondary) { create(:geo_node) }
let_it_be(:synced_registry) { create(:geo_upload_registry, :with_file, :attachment, success: true) }
let_it_be(:failed_registry) { create(:geo_upload_registry, :failed) }
let_it_be(:never_registry) { create(:geo_upload_registry, :failed, retry_count: nil) }
def css_id(registry)
"#upload-#{registry.id}-header"
......
......@@ -5,19 +5,19 @@ require 'spec_helper'
describe GroupsController do
include ExternalAuthorizationServiceHelpers
set(:user) { create(:user) }
set(:group) { create(:group, :public) }
set(:project) { create(:project, :public, namespace: group) }
set(:subgroup) { create(:group, :private, parent: group) }
set(:subgroup2) { create(:group, :private, parent: subgroup) }
let_it_be(:user) { create(:user) }
let_it_be(:group) { create(:group, :public) }
let_it_be(:project) { create(:project, :public, namespace: group) }
let_it_be(:subgroup) { create(:group, :private, parent: group) }
let_it_be(:subgroup2) { create(:group, :private, parent: subgroup) }
describe 'GET #activity' do
render_views
set(:event1) { create(:event, project: project) }
set(:event2) { create(:event, project: nil, group: group) }
set(:event3) { create(:event, project: nil, group: subgroup) }
set(:event4) { create(:event, project: nil, group: subgroup2) }
let_it_be(:event1) { create(:event, project: project) }
let_it_be(:event2) { create(:event, project: nil, group: group) }
let_it_be(:event3) { create(:event, project: nil, group: subgroup) }
let_it_be(:event4) { create(:event, project: nil, group: subgroup2) }
context 'when authorized' do
before do
......
......@@ -2,12 +2,12 @@
require 'spec_helper'
describe Projects::AutocompleteSourcesController do
set(:user) { create(:user) }
set(:group) { create(:group) }
set(:group2) { create(:group) }
set(:project) { create(:project, :public, group: group) }
set(:epic) { create(:epic, group: group) }
set(:epic2) { create(:epic, group: group2) }
let_it_be(:user) { create(:user) }
let_it_be(:group) { create(:group) }
let_it_be(:group2) { create(:group) }
let_it_be(:project) { create(:project, :public, group: group) }
let_it_be(:epic) { create(:epic, group: group) }
let_it_be(:epic2) { create(:epic, group: group2) }
before do
sign_in(user)
......
......@@ -8,7 +8,7 @@ describe RootController do
describe 'GET #index' do
context 'when user is not logged in' do
context 'on a Geo primary node' do
set(:primary_node) { create(:geo_node, :primary) }
let_it_be(:primary_node) { create(:geo_node, :primary) }
before do
stub_current_geo_node(primary_node)
......@@ -34,7 +34,7 @@ describe RootController do
end
context 'on a Geo secondary node' do
set(:secondary_node) { create(:geo_node) }
let_it_be(:secondary_node) { create(:geo_node) }
before do
stub_current_geo_node(secondary_node)
......
......@@ -12,8 +12,8 @@ describe SessionsController, :geo do
describe '#new' do
context 'on a Geo secondary node' do
set(:primary_node) { create(:geo_node, :primary) }
set(:secondary_node) { create(:geo_node) }
let_it_be(:primary_node) { create(:geo_node, :primary) }
let_it_be(:secondary_node) { create(:geo_node) }
before do
stub_current_geo_node(secondary_node)
......
......@@ -5,7 +5,7 @@ require 'spec_helper'
describe Groups::ClustersController do
include AccessMatchersForController
set(:group) { create(:group) }
let_it_be(:group) { create(:group) }
let(:user) { create(:user) }
......
......@@ -3,11 +3,11 @@
require 'spec_helper'
describe Groups::InsightsController do
set(:parent_group) { create(:group, :private) }
set(:nested_group) { create(:group, :private, parent: parent_group) }
set(:project) { create(:project, :private) }
set(:insight) { create(:insight, group: parent_group, project: project) }
set(:user) { create(:user) }
let_it_be(:parent_group) { create(:group, :private) }
let_it_be(:nested_group) { create(:group, :private, parent: parent_group) }
let_it_be(:project) { create(:project, :private) }
let_it_be(:insight) { create(:insight, group: parent_group, project: project) }
let_it_be(:user) { create(:user) }
let(:query_params) { { type: 'bar', query: { issuable_type: 'issue', collection_labels: ['bug'] }, projects: projects_params } }
let(:projects_params) { { only: [project.id, project.full_path] } }
let(:params) { { trailing_slash: true } }
......
......@@ -3,8 +3,8 @@
require 'spec_helper'
describe Projects::Alerting::NotificationsController do
set(:project) { create(:project) }
set(:environment) { create(:environment, project: project) }
let_it_be(:project) { create(:project) }
let_it_be(:environment) { create(:environment, project: project) }
describe 'POST #create' do
let(:service_response) { ServiceResponse.success }
......
......@@ -3,7 +3,7 @@
require 'spec_helper'
describe Projects::BranchesController do
set(:project) { create(:project, :repository) }
let_it_be(:project) { create(:project, :repository) }
let(:user) { project.owner }
before do
......
......@@ -3,7 +3,7 @@
require 'spec_helper'
describe Projects::ClustersController do
set(:project) { create(:project) }
let_it_be(:project) { create(:project) }
it_behaves_like 'cluster metrics' do
let(:user) { create(:user) }
......
......@@ -5,8 +5,8 @@ require 'spec_helper'
describe Projects::DesignsController do
include DesignManagementTestHelpers
set(:project) { create(:project, :public) }
set(:issue) { create(:issue, project: project) }
let_it_be(:project) { create(:project, :public) }
let_it_be(:issue) { create(:issue, project: project) }
let(:file) { fixture_file_upload('spec/fixtures/dk.png', '`/png') }
let(:lfs_pointer) { Gitlab::Git::LfsPointerFile.new(file.read) }
let(:design) { create(:design, :with_lfs_file, file: lfs_pointer.pointer, issue: issue) }
......
......@@ -5,10 +5,10 @@ require 'spec_helper'
describe Projects::EnvironmentsController do
include KubernetesHelpers
set(:user) { create(:user) }
set(:project) { create(:project) }
let_it_be(:user) { create(:user) }
let_it_be(:project) { create(:project) }
set(:environment) do
let_it_be(:environment) do
create(:environment, name: 'production', project: project)
end
......
......@@ -5,8 +5,8 @@ require 'spec_helper'
describe Projects::FeatureFlagsClientsController do
include Gitlab::Routing
set(:project) { create(:project) }
set(:user) { create(:user) }
let_it_be(:project) { create(:project) }
let_it_be(:user) { create(:user) }
describe 'POST reset_token.json' do
subject(:reset_token) do
......
......@@ -6,7 +6,7 @@ describe Projects::FeatureFlagsController do
include Gitlab::Routing
include FeatureFlagHelpers
set(:project) { create(:project) }
let_it_be(:project) { create(:project) }
let(:user) { developer }
let(:developer) { create(:user) }
let(:reporter) { create(:user) }
......
......@@ -5,10 +5,10 @@ require 'spec_helper'
describe Projects::LogsController do
include KubernetesHelpers
set(:user) { create(:user) }
set(:project) { create(:project) }
let_it_be(:user) { create(:user) }
let_it_be(:project) { create(:project) }
set(:environment) do
let_it_be(:environment) do
create(:environment, name: 'production', project: project)
end
......
......@@ -6,7 +6,7 @@ describe Projects::MirrorsController do
include ReactiveCachingHelpers
describe 'setting up a remote mirror' do
set(:project) { create(:project, :repository) }
let_it_be(:project) { create(:project, :repository) }
let(:url) { 'http://foo.com' }
context 'when the current project is a mirror' do
......
......@@ -3,10 +3,10 @@
require 'spec_helper'
describe Projects::Prometheus::AlertsController do
set(:user) { create(:user) }
set(:project) { create(:project) }
set(:environment) { create(:environment, project: project) }
set(:metric) { create(:prometheus_metric, project: project) }
let_it_be(:user) { create(:user) }
let_it_be(:project) { create(:project) }
let_it_be(:environment) { create(:environment, project: project) }
let_it_be(:metric) { create(:prometheus_metric, project: project) }
before do
stub_licensed_features(prometheus_alerts: true)
......
......@@ -3,9 +3,9 @@
require 'spec_helper'
describe Projects::Security::DashboardController do
set(:group) { create(:group) }
set(:project) { create(:project, :repository, :public, namespace: group) }
set(:user) { create(:user) }
let_it_be(:group) { create(:group) }
let_it_be(:project) { create(:project, :repository, :public, namespace: group) }
let_it_be(:user) { create(:user) }
it_behaves_like SecurityDashboardsPermissions do
let(:vulnerable) { project }
......
......@@ -3,7 +3,7 @@
require 'spec_helper'
describe Projects::Settings::OperationsController do
set(:user) { create(:user) }
let_it_be(:user) { create(:user) }
before do
sign_in(user)
......
......@@ -3,8 +3,8 @@
require 'spec_helper'
describe Projects::ThreatMonitoringController do
set(:project) { create(:project, :repository, :private) }
set(:user) { create(:user) }
let_it_be(:project) { create(:project, :repository, :private) }
let_it_be(:user) { create(:user) }
subject { get :show, params: { namespace_id: project.namespace, project_id: project } }
......
......@@ -3,7 +3,7 @@
require 'spec_helper'
describe Projects::TracingsController do
set(:user) { create(:user) }
let_it_be(:user) { create(:user) }
describe 'GET show' do
shared_examples 'user with read access' do |visibility_level|
......
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