Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
cd012678
Commit
cd012678
authored
Sep 25, 2019
by
Thong Kuah
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use let_it_be for spec/controllers
Mass-replace set for let_it_be.
parent
6e1f17da
Changes
25
Hide whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
62 additions
and
60 deletions
+62
-60
spec/controllers/admin/clusters_controller_spec.rb
spec/controllers/admin/clusters_controller_spec.rb
+2
-2
spec/controllers/admin/requests_profiles_controller_spec.rb
spec/controllers/admin/requests_profiles_controller_spec.rb
+1
-1
spec/controllers/admin/users_controller_spec.rb
spec/controllers/admin/users_controller_spec.rb
+1
-1
spec/controllers/groups/clusters_controller_spec.rb
spec/controllers/groups/clusters_controller_spec.rb
+3
-3
spec/controllers/groups/labels_controller_spec.rb
spec/controllers/groups/labels_controller_spec.rb
+7
-7
spec/controllers/groups/shared_projects_controller_spec.rb
spec/controllers/groups/shared_projects_controller_spec.rb
+3
-3
spec/controllers/import/bitbucket_server_controller_spec.rb
spec/controllers/import/bitbucket_server_controller_spec.rb
+1
-1
spec/controllers/import/gitlab_projects_controller_spec.rb
spec/controllers/import/gitlab_projects_controller_spec.rb
+2
-2
spec/controllers/projects/artifacts_controller_spec.rb
spec/controllers/projects/artifacts_controller_spec.rb
+2
-2
spec/controllers/projects/autocomplete_sources_controller_spec.rb
...trollers/projects/autocomplete_sources_controller_spec.rb
+4
-4
spec/controllers/projects/clusters_controller_spec.rb
spec/controllers/projects/clusters_controller_spec.rb
+3
-3
spec/controllers/projects/commit_controller_spec.rb
spec/controllers/projects/commit_controller_spec.rb
+4
-3
spec/controllers/projects/environments/prometheus_api_controller_spec.rb
...s/projects/environments/prometheus_api_controller_spec.rb
+3
-3
spec/controllers/projects/environments_controller_spec.rb
spec/controllers/projects/environments_controller_spec.rb
+3
-3
spec/controllers/projects/error_tracking_controller_spec.rb
spec/controllers/projects/error_tracking_controller_spec.rb
+2
-2
spec/controllers/projects/mirrors_controller_spec.rb
spec/controllers/projects/mirrors_controller_spec.rb
+1
-1
spec/controllers/projects/pipeline_schedules_controller_spec.rb
...ontrollers/projects/pipeline_schedules_controller_spec.rb
+8
-8
spec/controllers/projects/pipelines_controller_spec.rb
spec/controllers/projects/pipelines_controller_spec.rb
+1
-1
spec/controllers/projects/pipelines_settings_controller_spec.rb
...ontrollers/projects/pipelines_settings_controller_spec.rb
+2
-2
spec/controllers/projects/settings/ci_cd_controller_spec.rb
spec/controllers/projects/settings/ci_cd_controller_spec.rb
+2
-2
spec/controllers/projects/settings/operations_controller_spec.rb
...ntrollers/projects/settings/operations_controller_spec.rb
+2
-2
spec/controllers/projects/wikis_controller_spec.rb
spec/controllers/projects/wikis_controller_spec.rb
+2
-2
spec/controllers/projects_controller_spec.rb
spec/controllers/projects_controller_spec.rb
+1
-1
spec/controllers/search_controller_spec.rb
spec/controllers/search_controller_spec.rb
+1
-1
spec/spec_helper.rb
spec/spec_helper.rb
+1
-0
No files found.
spec/controllers/admin/clusters_controller_spec.rb
View file @
cd012678
...
...
@@ -469,7 +469,7 @@ describe Admin::ClustersController do
end
describe
'security'
do
set
(
:cluster
)
{
create
(
:cluster
,
:provided_by_gcp
,
:instance
)
}
let_it_be
(
:cluster
)
{
create
(
:cluster
,
:provided_by_gcp
,
:instance
)
}
it
{
expect
{
put_update
}.
to
be_allowed_for
(
:admin
)
}
it
{
expect
{
put_update
}.
to
be_denied_for
(
:user
)
}
...
...
@@ -531,7 +531,7 @@ describe Admin::ClustersController do
end
describe
'security'
do
set
(
:cluster
)
{
create
(
:cluster
,
:provided_by_gcp
,
:production_environment
,
:instance
)
}
let_it_be
(
:cluster
)
{
create
(
:cluster
,
:provided_by_gcp
,
:production_environment
,
:instance
)
}
it
{
expect
{
delete_destroy
}.
to
be_allowed_for
(
:admin
)
}
it
{
expect
{
delete_destroy
}.
to
be_denied_for
(
:user
)
}
...
...
spec/controllers/admin/requests_profiles_controller_spec.rb
View file @
cd012678
...
...
@@ -3,7 +3,7 @@
require
'spec_helper'
describe
Admin
::
RequestsProfilesController
do
set
(
:admin
)
{
create
(
:admin
)
}
let_it_be
(
:admin
)
{
create
(
:admin
)
}
before
do
sign_in
(
admin
)
...
...
spec/controllers/admin/users_controller_spec.rb
View file @
cd012678
...
...
@@ -4,7 +4,7 @@ require 'spec_helper'
describe
Admin
::
UsersController
do
let
(
:user
)
{
create
(
:user
)
}
set
(
:admin
)
{
create
(
:admin
)
}
let_it_be
(
:admin
)
{
create
(
:admin
)
}
before
do
sign_in
(
admin
)
...
...
spec/controllers/groups/clusters_controller_spec.rb
View file @
cd012678
...
...
@@ -6,7 +6,7 @@ describe Groups::ClustersController do
include
AccessMatchersForController
include
GoogleApi
::
CloudPlatformHelpers
set
(
:group
)
{
create
(
:group
)
}
let_it_be
(
:group
)
{
create
(
:group
)
}
let
(
:user
)
{
create
(
:user
)
}
...
...
@@ -536,7 +536,7 @@ describe Groups::ClustersController do
end
describe
'security'
do
set
(
:cluster
)
{
create
(
:cluster
,
:provided_by_gcp
,
cluster_type: :group_type
,
groups:
[
group
])
}
let_it_be
(
:cluster
)
{
create
(
:cluster
,
:provided_by_gcp
,
cluster_type: :group_type
,
groups:
[
group
])
}
it
{
expect
{
go
}.
to
be_allowed_for
(
:admin
)
}
it
{
expect
{
go
}.
to
be_allowed_for
(
:owner
).
of
(
group
)
}
...
...
@@ -604,7 +604,7 @@ describe Groups::ClustersController do
end
describe
'security'
do
set
(
:cluster
)
{
create
(
:cluster
,
:provided_by_gcp
,
:production_environment
,
cluster_type: :group_type
,
groups:
[
group
])
}
let_it_be
(
:cluster
)
{
create
(
:cluster
,
:provided_by_gcp
,
:production_environment
,
cluster_type: :group_type
,
groups:
[
group
])
}
it
{
expect
{
go
}.
to
be_allowed_for
(
:admin
)
}
it
{
expect
{
go
}.
to
be_allowed_for
(
:owner
).
of
(
group
)
}
...
...
spec/controllers/groups/labels_controller_spec.rb
View file @
cd012678
...
...
@@ -3,9 +3,9 @@
require
'spec_helper'
describe
Groups
::
LabelsController
do
set
(
:group
)
{
create
(
:group
)
}
set
(
:user
)
{
create
(
:user
)
}
set
(
:project
)
{
create
(
:project
,
namespace:
group
)
}
let_it_be
(
:group
)
{
create
(
:group
)
}
let_it_be
(
:user
)
{
create
(
:user
)
}
let_it_be
(
:project
)
{
create
(
:project
,
namespace:
group
)
}
before
do
group
.
add_owner
(
user
)
...
...
@@ -14,8 +14,8 @@ describe Groups::LabelsController do
end
describe
'GET #index'
do
set
(
:label_1
)
{
create
(
:label
,
project:
project
,
title:
'label_1'
)
}
set
(
:group_label_1
)
{
create
(
:group_label
,
group:
group
,
title:
'group_label_1'
)
}
let_it_be
(
:label_1
)
{
create
(
:label
,
project:
project
,
title:
'label_1'
)
}
let_it_be
(
:group_label_1
)
{
create
(
:group_label
,
group:
group
,
title:
'group_label_1'
)
}
it
'returns group and project labels by default'
do
get
:index
,
params:
{
group_id:
group
},
format: :json
...
...
@@ -25,8 +25,8 @@ describe Groups::LabelsController do
end
context
'with ancestor group'
do
set
(
:subgroup
)
{
create
(
:group
,
parent:
group
)
}
set
(
:subgroup_label_1
)
{
create
(
:group_label
,
group:
subgroup
,
title:
'subgroup_label_1'
)
}
let_it_be
(
:subgroup
)
{
create
(
:group
,
parent:
group
)
}
let_it_be
(
:subgroup_label_1
)
{
create
(
:group_label
,
group:
subgroup
,
title:
'subgroup_label_1'
)
}
before
do
subgroup
.
add_owner
(
user
)
...
...
spec/controllers/groups/shared_projects_controller_spec.rb
View file @
cd012678
...
...
@@ -17,9 +17,9 @@ describe Groups::SharedProjectsController do
).
execute
(
group
)
end
set
(
:group
)
{
create
(
:group
)
}
set
(
:user
)
{
create
(
:user
)
}
set
(
:shared_project
)
do
let_it_be
(
:group
)
{
create
(
:group
)
}
let_it_be
(
:user
)
{
create
(
:user
)
}
let_it_be
(
:shared_project
)
do
shared_project
=
create
(
:project
,
namespace:
user
.
namespace
)
share_project
(
shared_project
)
...
...
spec/controllers/import/bitbucket_server_controller_spec.rb
View file @
cd012678
...
...
@@ -39,7 +39,7 @@ describe Import::BitbucketServerController do
assign_session_tokens
end
set
(
:project
)
{
create
(
:project
)
}
let_it_be
(
:project
)
{
create
(
:project
)
}
it
'returns the new project'
do
allow
(
Gitlab
::
BitbucketServerImport
::
ProjectCreator
)
...
...
spec/controllers/import/gitlab_projects_controller_spec.rb
View file @
cd012678
...
...
@@ -3,8 +3,8 @@
require
'spec_helper'
describe
Import
::
GitlabProjectsController
do
set
(
:namespace
)
{
create
(
:namespace
)
}
set
(
:user
)
{
namespace
.
owner
}
let_it_be
(
:namespace
)
{
create
(
:namespace
)
}
let_it_be
(
:user
)
{
namespace
.
owner
}
let
(
:file
)
{
fixture_file_upload
(
'spec/fixtures/project_export.tar.gz'
,
'text/plain'
)
}
before
do
...
...
spec/controllers/projects/artifacts_controller_spec.rb
View file @
cd012678
...
...
@@ -4,9 +4,9 @@ require 'spec_helper'
describe
Projects
::
ArtifactsController
do
let
(
:user
)
{
project
.
owner
}
set
(
:project
)
{
create
(
:project
,
:repository
,
:public
)
}
let_it_be
(
:project
)
{
create
(
:project
,
:repository
,
:public
)
}
set
(
:pipeline
)
do
let_it_be
(
:pipeline
)
do
create
(
:ci_pipeline
,
project:
project
,
sha:
project
.
commit
.
sha
,
...
...
spec/controllers/projects/autocomplete_sources_controller_spec.rb
View file @
cd012678
...
...
@@ -3,10 +3,10 @@
require
'spec_helper'
describe
Projects
::
AutocompleteSourcesController
do
set
(
:group
)
{
create
(
:group
)
}
set
(
:project
)
{
create
(
:project
,
namespace:
group
)
}
set
(
:issue
)
{
create
(
:issue
,
project:
project
)
}
set
(
:user
)
{
create
(
:user
)
}
let_it_be
(
:group
)
{
create
(
:group
)
}
let_it_be
(
:project
)
{
create
(
:project
,
namespace:
group
)
}
let_it_be
(
:issue
)
{
create
(
:issue
,
project:
project
)
}
let_it_be
(
:user
)
{
create
(
:user
)
}
describe
'GET members'
do
before
do
...
...
spec/controllers/projects/clusters_controller_spec.rb
View file @
cd012678
...
...
@@ -7,7 +7,7 @@ describe Projects::ClustersController do
include
GoogleApi
::
CloudPlatformHelpers
include
KubernetesHelpers
set
(
:project
)
{
create
(
:project
)
}
let_it_be
(
:project
)
{
create
(
:project
)
}
let
(
:user
)
{
create
(
:user
)
}
...
...
@@ -536,7 +536,7 @@ describe Projects::ClustersController do
end
describe
'security'
do
set
(
:cluster
)
{
create
(
:cluster
,
:provided_by_gcp
,
projects:
[
project
])
}
let_it_be
(
:cluster
)
{
create
(
:cluster
,
:provided_by_gcp
,
projects:
[
project
])
}
it
{
expect
{
go
}.
to
be_allowed_for
(
:admin
)
}
it
{
expect
{
go
}.
to
be_allowed_for
(
:owner
).
of
(
project
)
}
...
...
@@ -605,7 +605,7 @@ describe Projects::ClustersController do
end
describe
'security'
do
set
(
:cluster
)
{
create
(
:cluster
,
:provided_by_gcp
,
:production_environment
,
projects:
[
project
])
}
let_it_be
(
:cluster
)
{
create
(
:cluster
,
:provided_by_gcp
,
:production_environment
,
projects:
[
project
])
}
it
{
expect
{
go
}.
to
be_allowed_for
(
:admin
)
}
it
{
expect
{
go
}.
to
be_allowed_for
(
:owner
).
of
(
project
)
}
...
...
spec/controllers/projects/commit_controller_spec.rb
View file @
cd012678
...
...
@@ -3,9 +3,10 @@
require
'spec_helper'
describe
Projects
::
CommitController
do
set
(
:project
)
{
create
(
:project
,
:repository
)
}
set
(
:user
)
{
create
(
:user
)
}
let
(
:commit
)
{
project
.
commit
(
"master"
)
}
let_it_be
(
:project
)
{
create
(
:project
,
:repository
)
}
let_it_be
(
:user
)
{
create
(
:user
)
}
let
(
:commit
)
{
project
.
commit
(
"master"
)
}
let
(
:master_pickable_sha
)
{
'7d3b0f7cff5f37573aea97cebfd5692ea1689924'
}
let
(
:master_pickable_commit
)
{
project
.
commit
(
master_pickable_sha
)
}
...
...
spec/controllers/projects/environments/prometheus_api_controller_spec.rb
View file @
cd012678
...
...
@@ -3,9 +3,9 @@
require
'spec_helper'
describe
Projects
::
Environments
::
PrometheusApiController
do
set
(
:project
)
{
create
(
:project
)
}
set
(
:environment
)
{
create
(
:environment
,
project:
project
)
}
set
(
:user
)
{
create
(
:user
)
}
let_it_be
(
:project
)
{
create
(
:project
)
}
let_it_be
(
:environment
)
{
create
(
:environment
,
project:
project
)
}
let_it_be
(
:user
)
{
create
(
:user
)
}
before
do
project
.
add_reporter
(
user
)
...
...
spec/controllers/projects/environments_controller_spec.rb
View file @
cd012678
...
...
@@ -5,10 +5,10 @@ require 'spec_helper'
describe
Projects
::
EnvironmentsController
do
include
MetricsDashboardHelpers
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
...
...
spec/controllers/projects/error_tracking_controller_spec.rb
View file @
cd012678
...
...
@@ -3,8 +3,8 @@
require
'spec_helper'
describe
Projects
::
ErrorTrackingController
do
set
(
:project
)
{
create
(
:project
)
}
set
(
:user
)
{
create
(
:user
)
}
let_it_be
(
:project
)
{
create
(
:project
)
}
let_it_be
(
:user
)
{
create
(
:user
)
}
before
do
sign_in
(
user
)
...
...
spec/controllers/projects/mirrors_controller_spec.rb
View file @
cd012678
...
...
@@ -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
)
}
context
'when the current project is not a mirror'
do
it
'allows to create a remote mirror'
do
...
...
spec/controllers/projects/pipeline_schedules_controller_spec.rb
View file @
cd012678
...
...
@@ -5,9 +5,9 @@ require 'spec_helper'
describe
Projects
::
PipelineSchedulesController
do
include
AccessMatchersForController
set
(
:user
)
{
create
(
:user
)
}
set
(
:project
)
{
create
(
:project
,
:public
,
:repository
)
}
set
(
:pipeline_schedule
)
{
create
(
:ci_pipeline_schedule
,
project:
project
)
}
let_it_be
(
:user
)
{
create
(
:user
)
}
let_it_be
(
:project
)
{
create
(
:project
,
:public
,
:repository
)
}
let_it_be
(
:pipeline_schedule
)
{
create
(
:ci_pipeline_schedule
,
project:
project
)
}
before
do
project
.
add_developer
(
user
)
...
...
@@ -60,7 +60,7 @@ describe Projects::PipelineSchedulesController do
end
describe
'GET #new'
do
set
(
:user
)
{
create
(
:user
)
}
let_it_be
(
:user
)
{
create
(
:user
)
}
before
do
project
.
add_developer
(
user
)
...
...
@@ -77,7 +77,7 @@ describe Projects::PipelineSchedulesController do
describe
'POST #create'
do
describe
'functionality'
do
set
(
:user
)
{
create
(
:user
)
}
let_it_be
(
:user
)
{
create
(
:user
)
}
before
do
project
.
add_developer
(
user
)
...
...
@@ -149,7 +149,7 @@ describe Projects::PipelineSchedulesController do
describe
'PUT #update'
do
describe
'functionality'
do
set
(
:user
)
{
create
(
:user
)
}
let_it_be
(
:user
)
{
create
(
:user
)
}
let!
(
:pipeline_schedule
)
{
create
(
:ci_pipeline_schedule
,
project:
project
,
owner:
user
)
}
before
do
...
...
@@ -383,7 +383,7 @@ describe Projects::PipelineSchedulesController do
end
describe
'POST #play'
,
:clean_gitlab_redis_cache
do
set
(
:user
)
{
create
(
:user
)
}
let_it_be
(
:user
)
{
create
(
:user
)
}
let
(
:ref
)
{
'master'
}
before
do
...
...
@@ -442,7 +442,7 @@ describe Projects::PipelineSchedulesController do
end
describe
'DELETE #destroy'
do
set
(
:user
)
{
create
(
:user
)
}
let_it_be
(
:user
)
{
create
(
:user
)
}
context
'when a developer makes the request'
do
before
do
...
...
spec/controllers/projects/pipelines_controller_spec.rb
View file @
cd012678
...
...
@@ -5,7 +5,7 @@ require 'spec_helper'
describe
Projects
::
PipelinesController
do
include
ApiHelpers
set
(
:user
)
{
create
(
:user
)
}
let_it_be
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
,
:public
,
:repository
)
}
let
(
:feature
)
{
ProjectFeature
::
ENABLED
}
...
...
spec/controllers/projects/pipelines_settings_controller_spec.rb
View file @
cd012678
...
...
@@ -3,8 +3,8 @@
require
'spec_helper'
describe
Projects
::
PipelinesSettingsController
do
set
(
:user
)
{
create
(
:user
)
}
set
(
:project_auto_devops
)
{
create
(
:project_auto_devops
)
}
let_it_be
(
:user
)
{
create
(
:user
)
}
let_it_be
(
:project_auto_devops
)
{
create
(
:project_auto_devops
)
}
let
(
:project
)
{
project_auto_devops
.
project
}
before
do
...
...
spec/controllers/projects/settings/ci_cd_controller_spec.rb
View file @
cd012678
...
...
@@ -3,8 +3,8 @@
require
(
'spec_helper'
)
describe
Projects
::
Settings
::
CiCdController
do
set
(
:user
)
{
create
(
:user
)
}
set
(
:project_auto_devops
)
{
create
(
:project_auto_devops
)
}
let_it_be
(
:user
)
{
create
(
:user
)
}
let_it_be
(
:project_auto_devops
)
{
create
(
:project_auto_devops
)
}
let
(
:project
)
{
project_auto_devops
.
project
}
before
do
...
...
spec/controllers/projects/settings/operations_controller_spec.rb
View file @
cd012678
...
...
@@ -3,8 +3,8 @@
require
'spec_helper'
describe
Projects
::
Settings
::
OperationsController
do
set
(
:user
)
{
create
(
:user
)
}
set
(
:project
)
{
create
(
:project
)
}
let_it_be
(
:user
)
{
create
(
:user
)
}
let_it_be
(
:project
)
{
create
(
:project
)
}
before
do
sign_in
(
user
)
...
...
spec/controllers/projects/wikis_controller_spec.rb
View file @
cd012678
...
...
@@ -3,8 +3,8 @@
require
'spec_helper'
describe
Projects
::
WikisController
do
set
(
:project
)
{
create
(
:project
,
:public
,
:repository
)
}
set
(
:user
)
{
project
.
owner
}
let_it_be
(
:project
)
{
create
(
:project
,
:public
,
:repository
)
}
let_it_be
(
:user
)
{
project
.
owner
}
let
(
:project_wiki
)
{
ProjectWiki
.
new
(
project
,
user
)
}
let
(
:wiki
)
{
project_wiki
.
wiki
}
let
(
:wiki_title
)
{
'page title test'
}
...
...
spec/controllers/projects_controller_spec.rb
View file @
cd012678
...
...
@@ -149,7 +149,7 @@ describe ProjectsController do
end
context
'when the storage is not available'
,
:broken_storage
do
set
(
:project
)
{
create
(
:project
,
:broken_storage
)
}
let_it_be
(
:project
)
{
create
(
:project
,
:broken_storage
)
}
before
do
project
.
add_developer
(
user
)
...
...
spec/controllers/search_controller_spec.rb
View file @
cd012678
...
...
@@ -67,7 +67,7 @@ describe SearchController do
using
RSpec
::
Parameterized
::
TableSyntax
render_views
set
(
:project
)
{
create
(
:project
,
:public
,
:repository
,
:wiki_repo
)
}
let_it_be
(
:project
)
{
create
(
:project
,
:public
,
:repository
,
:wiki_repo
)
}
before
do
expect
(
::
Gitlab
::
GitalyClient
).
to
receive
(
:allow_ref_name_caching
).
and_call_original
...
...
spec/spec_helper.rb
View file @
cd012678
...
...
@@ -10,6 +10,7 @@ require 'rspec/rails'
require
'shoulda/matchers'
require
'rspec/retry'
require
'rspec-parameterized'
require
"test_prof/recipes/rspec/let_it_be"
rspec_profiling_is_configured
=
ENV
[
'RSPEC_PROFILING_POSTGRES_URL'
].
present?
||
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment