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
0
Merge Requests
0
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
Jérome Perrin
gitlab-ce
Commits
4642ca66
Commit
4642ca66
authored
Jan 25, 2017
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use `empty_project` where possible in controller specs
parent
d5583912
Changes
43
Hide whitespace changes
Inline
Side-by-side
Showing
43 changed files
with
67 additions
and
74 deletions
+67
-74
spec/controllers/admin/groups_controller_spec.rb
spec/controllers/admin/groups_controller_spec.rb
+1
-1
spec/controllers/admin/projects_controller_spec.rb
spec/controllers/admin/projects_controller_spec.rb
+1
-1
spec/controllers/autocomplete_controller_spec.rb
spec/controllers/autocomplete_controller_spec.rb
+1
-1
spec/controllers/blob_controller_spec.rb
spec/controllers/blob_controller_spec.rb
+1
-1
spec/controllers/ci/projects_controller_spec.rb
spec/controllers/ci/projects_controller_spec.rb
+1
-1
spec/controllers/dashboard/todos_controller_spec.rb
spec/controllers/dashboard/todos_controller_spec.rb
+1
-1
spec/controllers/groups/milestones_controller_spec.rb
spec/controllers/groups/milestones_controller_spec.rb
+1
-1
spec/controllers/groups_controller_spec.rb
spec/controllers/groups_controller_spec.rb
+1
-1
spec/controllers/import/bitbucket_controller_spec.rb
spec/controllers/import/bitbucket_controller_spec.rb
+2
-2
spec/controllers/import/fogbugz_controller_spec.rb
spec/controllers/import/fogbugz_controller_spec.rb
+2
-2
spec/controllers/import/gitlab_controller_spec.rb
spec/controllers/import/gitlab_controller_spec.rb
+2
-2
spec/controllers/import/google_code_controller_spec.rb
spec/controllers/import/google_code_controller_spec.rb
+2
-2
spec/controllers/notification_settings_controller_spec.rb
spec/controllers/notification_settings_controller_spec.rb
+1
-1
spec/controllers/projects/avatars_controller_spec.rb
spec/controllers/projects/avatars_controller_spec.rb
+1
-1
spec/controllers/projects/blame_controller_spec.rb
spec/controllers/projects/blame_controller_spec.rb
+1
-1
spec/controllers/projects/blob_controller_spec.rb
spec/controllers/projects/blob_controller_spec.rb
+1
-1
spec/controllers/projects/branches_controller_spec.rb
spec/controllers/projects/branches_controller_spec.rb
+1
-1
spec/controllers/projects/commit_controller_spec.rb
spec/controllers/projects/commit_controller_spec.rb
+1
-1
spec/controllers/projects/commits_controller_spec.rb
spec/controllers/projects/commits_controller_spec.rb
+1
-1
spec/controllers/projects/compare_controller_spec.rb
spec/controllers/projects/compare_controller_spec.rb
+1
-1
spec/controllers/projects/cycle_analytics_controller_spec.rb
spec/controllers/projects/cycle_analytics_controller_spec.rb
+1
-1
spec/controllers/projects/discussions_controller_spec.rb
spec/controllers/projects/discussions_controller_spec.rb
+3
-3
spec/controllers/projects/find_file_controller_spec.rb
spec/controllers/projects/find_file_controller_spec.rb
+1
-1
spec/controllers/projects/forks_controller_spec.rb
spec/controllers/projects/forks_controller_spec.rb
+1
-1
spec/controllers/projects/graphs_controller_spec.rb
spec/controllers/projects/graphs_controller_spec.rb
+1
-1
spec/controllers/projects/group_links_controller_spec.rb
spec/controllers/projects/group_links_controller_spec.rb
+1
-1
spec/controllers/projects/issues_controller_spec.rb
spec/controllers/projects/issues_controller_spec.rb
+3
-3
spec/controllers/projects/milestones_controller_spec.rb
spec/controllers/projects/milestones_controller_spec.rb
+1
-1
spec/controllers/projects/notes_controller_spec.rb
spec/controllers/projects/notes_controller_spec.rb
+3
-1
spec/controllers/projects/project_members_controller_spec.rb
spec/controllers/projects/project_members_controller_spec.rb
+2
-2
spec/controllers/projects/raw_controller_spec.rb
spec/controllers/projects/raw_controller_spec.rb
+1
-1
spec/controllers/projects/refs_controller_spec.rb
spec/controllers/projects/refs_controller_spec.rb
+1
-1
spec/controllers/projects/releases_controller_spec.rb
spec/controllers/projects/releases_controller_spec.rb
+1
-1
spec/controllers/projects/repositories_controller_spec.rb
spec/controllers/projects/repositories_controller_spec.rb
+1
-1
spec/controllers/projects/services_controller_spec.rb
spec/controllers/projects/services_controller_spec.rb
+1
-1
spec/controllers/projects/settings/integrations_controller_spec.rb
...rollers/projects/settings/integrations_controller_spec.rb
+1
-1
spec/controllers/projects/tags_controller_spec.rb
spec/controllers/projects/tags_controller_spec.rb
+1
-1
spec/controllers/projects/templates_controller_spec.rb
spec/controllers/projects/templates_controller_spec.rb
+1
-1
spec/controllers/projects/tree_controller_spec.rb
spec/controllers/projects/tree_controller_spec.rb
+1
-1
spec/controllers/projects/uploads_controller_spec.rb
spec/controllers/projects/uploads_controller_spec.rb
+1
-1
spec/controllers/projects_controller_spec.rb
spec/controllers/projects_controller_spec.rb
+13
-22
spec/controllers/uploads_controller_spec.rb
spec/controllers/uploads_controller_spec.rb
+1
-1
spec/controllers/users_controller_spec.rb
spec/controllers/users_controller_spec.rb
+2
-2
No files found.
spec/controllers/admin/groups_controller_spec.rb
View file @
4642ca66
...
@@ -2,7 +2,7 @@ require 'spec_helper'
...
@@ -2,7 +2,7 @@ require 'spec_helper'
describe
Admin
::
GroupsController
do
describe
Admin
::
GroupsController
do
let
(
:group
)
{
create
(
:group
)
}
let
(
:group
)
{
create
(
:group
)
}
let
(
:project
)
{
create
(
:project
,
namespace:
group
)
}
let
(
:project
)
{
create
(
:
empty_
project
,
namespace:
group
)
}
let
(
:admin
)
{
create
(
:admin
)
}
let
(
:admin
)
{
create
(
:admin
)
}
before
do
before
do
...
...
spec/controllers/admin/projects_controller_spec.rb
View file @
4642ca66
require
'spec_helper'
require
'spec_helper'
describe
Admin
::
ProjectsController
do
describe
Admin
::
ProjectsController
do
let!
(
:project
)
{
create
(
:
project
,
visibility_level:
Gitlab
::
VisibilityLevel
::
PUBLIC
)
}
let!
(
:project
)
{
create
(
:
empty_project
,
:public
)
}
before
do
before
do
sign_in
(
create
(
:admin
))
sign_in
(
create
(
:admin
))
...
...
spec/controllers/autocomplete_controller_spec.rb
View file @
4642ca66
require
'spec_helper'
require
'spec_helper'
describe
AutocompleteController
do
describe
AutocompleteController
do
let!
(
:project
)
{
create
(
:project
)
}
let!
(
:project
)
{
create
(
:
empty_
project
)
}
let!
(
:user
)
{
create
(
:user
)
}
let!
(
:user
)
{
create
(
:user
)
}
context
'GET users'
do
context
'GET users'
do
...
...
spec/controllers/blob_controller_spec.rb
View file @
4642ca66
require
'spec_helper'
require
'spec_helper'
describe
Projects
::
BlobController
do
describe
Projects
::
BlobController
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
before
do
before
do
...
...
spec/controllers/ci/projects_controller_spec.rb
View file @
4642ca66
...
@@ -2,7 +2,7 @@ require 'spec_helper'
...
@@ -2,7 +2,7 @@ require 'spec_helper'
describe
Ci
::
ProjectsController
do
describe
Ci
::
ProjectsController
do
let
(
:visibility
)
{
:public
}
let
(
:visibility
)
{
:public
}
let!
(
:project
)
{
create
(
:project
,
visibility
,
ci_id:
1
)
}
let!
(
:project
)
{
create
(
:
empty_
project
,
visibility
,
ci_id:
1
)
}
let
(
:ci_id
)
{
project
.
ci_id
}
let
(
:ci_id
)
{
project
.
ci_id
}
describe
'#index'
do
describe
'#index'
do
...
...
spec/controllers/dashboard/todos_controller_spec.rb
View file @
4642ca66
...
@@ -2,7 +2,7 @@ require 'spec_helper'
...
@@ -2,7 +2,7 @@ require 'spec_helper'
describe
Dashboard
::
TodosController
do
describe
Dashboard
::
TodosController
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:
empty_
project
)
}
let
(
:todo_service
)
{
TodoService
.
new
}
let
(
:todo_service
)
{
TodoService
.
new
}
describe
'GET #index'
do
describe
'GET #index'
do
...
...
spec/controllers/groups/milestones_controller_spec.rb
View file @
4642ca66
...
@@ -2,7 +2,7 @@ require 'spec_helper'
...
@@ -2,7 +2,7 @@ require 'spec_helper'
describe
Groups
::
MilestonesController
do
describe
Groups
::
MilestonesController
do
let
(
:group
)
{
create
(
:group
)
}
let
(
:group
)
{
create
(
:group
)
}
let
(
:project
)
{
create
(
:project
,
group:
group
)
}
let
(
:project
)
{
create
(
:
empty_
project
,
group:
group
)
}
let
(
:project2
)
{
create
(
:empty_project
,
group:
group
)
}
let
(
:project2
)
{
create
(
:empty_project
,
group:
group
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:title
)
{
'肯定不是中文的问题'
}
let
(
:title
)
{
'肯定不是中文的问题'
}
...
...
spec/controllers/groups_controller_spec.rb
View file @
4642ca66
...
@@ -3,7 +3,7 @@ require 'rails_helper'
...
@@ -3,7 +3,7 @@ require 'rails_helper'
describe
GroupsController
do
describe
GroupsController
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:group
)
{
create
(
:group
)
}
let
(
:group
)
{
create
(
:group
)
}
let
(
:project
)
{
create
(
:project
,
namespace:
group
)
}
let
(
:project
)
{
create
(
:
empty_
project
,
namespace:
group
)
}
let!
(
:group_member
)
{
create
(
:group_member
,
group:
group
,
user:
user
)
}
let!
(
:group_member
)
{
create
(
:group_member
,
group:
group
,
user:
user
)
}
describe
'GET #index'
do
describe
'GET #index'
do
...
...
spec/controllers/import/bitbucket_controller_spec.rb
View file @
4642ca66
...
@@ -52,7 +52,7 @@ describe Import::BitbucketController do
...
@@ -52,7 +52,7 @@ describe Import::BitbucketController do
end
end
it
"assigns variables"
do
it
"assigns variables"
do
@project
=
create
(
:project
,
import_type:
'bitbucket'
,
creator_id:
user
.
id
)
@project
=
create
(
:
empty_
project
,
import_type:
'bitbucket'
,
creator_id:
user
.
id
)
allow_any_instance_of
(
Bitbucket
::
Client
).
to
receive
(
:repos
).
and_return
([
@repo
])
allow_any_instance_of
(
Bitbucket
::
Client
).
to
receive
(
:repos
).
and_return
([
@repo
])
get
:status
get
:status
...
@@ -63,7 +63,7 @@ describe Import::BitbucketController do
...
@@ -63,7 +63,7 @@ describe Import::BitbucketController do
end
end
it
"does not show already added project"
do
it
"does not show already added project"
do
@project
=
create
(
:project
,
import_type:
'bitbucket'
,
creator_id:
user
.
id
,
import_source:
'asd/vim'
)
@project
=
create
(
:
empty_
project
,
import_type:
'bitbucket'
,
creator_id:
user
.
id
,
import_source:
'asd/vim'
)
allow_any_instance_of
(
Bitbucket
::
Client
).
to
receive
(
:repos
).
and_return
([
@repo
])
allow_any_instance_of
(
Bitbucket
::
Client
).
to
receive
(
:repos
).
and_return
([
@repo
])
get
:status
get
:status
...
...
spec/controllers/import/fogbugz_controller_spec.rb
View file @
4642ca66
...
@@ -16,7 +16,7 @@ describe Import::FogbugzController do
...
@@ -16,7 +16,7 @@ describe Import::FogbugzController do
end
end
it
'assigns variables'
do
it
'assigns variables'
do
@project
=
create
(
:project
,
import_type:
'fogbugz'
,
creator_id:
user
.
id
)
@project
=
create
(
:
empty_
project
,
import_type:
'fogbugz'
,
creator_id:
user
.
id
)
stub_client
(
repos:
[
@repo
])
stub_client
(
repos:
[
@repo
])
get
:status
get
:status
...
@@ -26,7 +26,7 @@ describe Import::FogbugzController do
...
@@ -26,7 +26,7 @@ describe Import::FogbugzController do
end
end
it
'does not show already added project'
do
it
'does not show already added project'
do
@project
=
create
(
:project
,
import_type:
'fogbugz'
,
creator_id:
user
.
id
,
import_source:
'vim'
)
@project
=
create
(
:
empty_
project
,
import_type:
'fogbugz'
,
creator_id:
user
.
id
,
import_source:
'vim'
)
stub_client
(
repos:
[
@repo
])
stub_client
(
repos:
[
@repo
])
get
:status
get
:status
...
...
spec/controllers/import/gitlab_controller_spec.rb
View file @
4642ca66
...
@@ -36,7 +36,7 @@ describe Import::GitlabController do
...
@@ -36,7 +36,7 @@ describe Import::GitlabController do
end
end
it
"assigns variables"
do
it
"assigns variables"
do
@project
=
create
(
:project
,
import_type:
'gitlab'
,
creator_id:
user
.
id
)
@project
=
create
(
:
empty_
project
,
import_type:
'gitlab'
,
creator_id:
user
.
id
)
stub_client
(
projects:
[
@repo
])
stub_client
(
projects:
[
@repo
])
get
:status
get
:status
...
@@ -46,7 +46,7 @@ describe Import::GitlabController do
...
@@ -46,7 +46,7 @@ describe Import::GitlabController do
end
end
it
"does not show already added project"
do
it
"does not show already added project"
do
@project
=
create
(
:project
,
import_type:
'gitlab'
,
creator_id:
user
.
id
,
import_source:
'asd/vim'
)
@project
=
create
(
:
empty_
project
,
import_type:
'gitlab'
,
creator_id:
user
.
id
,
import_source:
'asd/vim'
)
stub_client
(
projects:
[
@repo
])
stub_client
(
projects:
[
@repo
])
get
:status
get
:status
...
...
spec/controllers/import/google_code_controller_spec.rb
View file @
4642ca66
...
@@ -27,7 +27,7 @@ describe Import::GoogleCodeController do
...
@@ -27,7 +27,7 @@ describe Import::GoogleCodeController do
end
end
it
"assigns variables"
do
it
"assigns variables"
do
@project
=
create
(
:project
,
import_type:
'google_code'
,
creator_id:
user
.
id
)
@project
=
create
(
:
empty_
project
,
import_type:
'google_code'
,
creator_id:
user
.
id
)
stub_client
(
repos:
[
@repo
],
incompatible_repos:
[])
stub_client
(
repos:
[
@repo
],
incompatible_repos:
[])
get
:status
get
:status
...
@@ -38,7 +38,7 @@ describe Import::GoogleCodeController do
...
@@ -38,7 +38,7 @@ describe Import::GoogleCodeController do
end
end
it
"does not show already added project"
do
it
"does not show already added project"
do
@project
=
create
(
:project
,
import_type:
'google_code'
,
creator_id:
user
.
id
,
import_source:
'vim'
)
@project
=
create
(
:
empty_
project
,
import_type:
'google_code'
,
creator_id:
user
.
id
,
import_source:
'vim'
)
stub_client
(
repos:
[
@repo
],
incompatible_repos:
[])
stub_client
(
repos:
[
@repo
],
incompatible_repos:
[])
get
:status
get
:status
...
...
spec/controllers/notification_settings_controller_spec.rb
View file @
4642ca66
...
@@ -93,7 +93,7 @@ describe NotificationSettingsController do
...
@@ -93,7 +93,7 @@ describe NotificationSettingsController do
end
end
context
'not authorized'
do
context
'not authorized'
do
let
(
:private_project
)
{
create
(
:project
,
:private
)
}
let
(
:private_project
)
{
create
(
:
empty_
project
,
:private
)
}
before
{
sign_in
(
user
)
}
before
{
sign_in
(
user
)
}
it
'returns 404'
do
it
'returns 404'
do
...
...
spec/controllers/projects/avatars_controller_spec.rb
View file @
4642ca66
require
'spec_helper'
require
'spec_helper'
describe
Projects
::
AvatarsController
do
describe
Projects
::
AvatarsController
do
let
(
:project
)
{
create
(
:project
,
avatar:
fixture_file_upload
(
Rails
.
root
+
"spec/fixtures/dk.png"
,
"image/png"
))
}
let
(
:project
)
{
create
(
:
empty_
project
,
avatar:
fixture_file_upload
(
Rails
.
root
+
"spec/fixtures/dk.png"
,
"image/png"
))
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
before
do
before
do
...
...
spec/controllers/projects/blame_controller_spec.rb
View file @
4642ca66
require
'spec_helper'
require
'spec_helper'
describe
Projects
::
BlameController
do
describe
Projects
::
BlameController
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
before
do
before
do
...
...
spec/controllers/projects/blob_controller_spec.rb
View file @
4642ca66
require
'rails_helper'
require
'rails_helper'
describe
Projects
::
BlobController
do
describe
Projects
::
BlobController
do
let
(
:project
)
{
create
(
:project
,
:public
)
}
let
(
:project
)
{
create
(
:project
,
:public
,
:repository
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
before
do
before
do
...
...
spec/controllers/projects/branches_controller_spec.rb
View file @
4642ca66
require
'spec_helper'
require
'spec_helper'
describe
Projects
::
BranchesController
do
describe
Projects
::
BranchesController
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:developer
)
{
create
(
:user
)
}
let
(
:developer
)
{
create
(
:user
)
}
...
...
spec/controllers/projects/commit_controller_spec.rb
View file @
4642ca66
require
'spec_helper'
require
'spec_helper'
describe
Projects
::
CommitController
do
describe
Projects
::
CommitController
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:commit
)
{
project
.
commit
(
"master"
)
}
let
(
:commit
)
{
project
.
commit
(
"master"
)
}
let
(
:pipeline
)
{
create
(
:ci_pipeline
,
project:
project
,
commit:
commit
)
}
let
(
:pipeline
)
{
create
(
:ci_pipeline
,
project:
project
,
commit:
commit
)
}
...
...
spec/controllers/projects/commits_controller_spec.rb
View file @
4642ca66
require
'spec_helper'
require
'spec_helper'
describe
Projects
::
CommitsController
do
describe
Projects
::
CommitsController
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
before
do
before
do
...
...
spec/controllers/projects/compare_controller_spec.rb
View file @
4642ca66
require
'spec_helper'
require
'spec_helper'
describe
Projects
::
CompareController
do
describe
Projects
::
CompareController
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:ref_from
)
{
"improve%2Fawesome"
}
let
(
:ref_from
)
{
"improve%2Fawesome"
}
let
(
:ref_to
)
{
"feature"
}
let
(
:ref_to
)
{
"feature"
}
...
...
spec/controllers/projects/cycle_analytics_controller_spec.rb
View file @
4642ca66
require
'spec_helper'
require
'spec_helper'
describe
Projects
::
CycleAnalyticsController
do
describe
Projects
::
CycleAnalyticsController
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
before
do
before
do
...
...
spec/controllers/projects/discussions_controller_spec.rb
View file @
4642ca66
require
'spec_helper'
require
'spec_helper'
describe
Projects
::
DiscussionsController
do
describe
Projects
::
DiscussionsController
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:
project
)
{
create
(
:projec
t
)
}
let
(
:
merge_request
)
{
create
(
:merge_reques
t
)
}
let
(
:
merge_request
)
{
create
(
:merge_request
,
source_project:
project
)
}
let
(
:
project
)
{
merge_request
.
source_project
}
let
(
:note
)
{
create
(
:diff_note_on_merge_request
,
noteable:
merge_request
,
project:
project
)
}
let
(
:note
)
{
create
(
:diff_note_on_merge_request
,
noteable:
merge_request
,
project:
project
)
}
let
(
:discussion
)
{
note
.
discussion
}
let
(
:discussion
)
{
note
.
discussion
}
...
...
spec/controllers/projects/find_file_controller_spec.rb
View file @
4642ca66
require
'spec_helper'
require
'spec_helper'
describe
Projects
::
FindFileController
do
describe
Projects
::
FindFileController
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
before
do
before
do
...
...
spec/controllers/projects/forks_controller_spec.rb
View file @
4642ca66
...
@@ -2,7 +2,7 @@ require 'spec_helper'
...
@@ -2,7 +2,7 @@ require 'spec_helper'
describe
Projects
::
ForksController
do
describe
Projects
::
ForksController
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
,
:public
)
}
let
(
:project
)
{
create
(
:project
,
:public
,
:repository
)
}
let
(
:forked_project
)
{
Projects
::
ForkService
.
new
(
project
,
user
).
execute
}
let
(
:forked_project
)
{
Projects
::
ForkService
.
new
(
project
,
user
).
execute
}
let
(
:group
)
{
create
(
:group
,
owner:
forked_project
.
creator
)
}
let
(
:group
)
{
create
(
:group
,
owner:
forked_project
.
creator
)
}
...
...
spec/controllers/projects/graphs_controller_spec.rb
View file @
4642ca66
require
'spec_helper'
require
'spec_helper'
describe
Projects
::
GraphsController
do
describe
Projects
::
GraphsController
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
before
do
before
do
...
...
spec/controllers/projects/group_links_controller_spec.rb
View file @
4642ca66
...
@@ -3,7 +3,7 @@ require 'spec_helper'
...
@@ -3,7 +3,7 @@ require 'spec_helper'
describe
Projects
::
GroupLinksController
do
describe
Projects
::
GroupLinksController
do
let
(
:group
)
{
create
(
:group
,
:private
)
}
let
(
:group
)
{
create
(
:group
,
:private
)
}
let
(
:group2
)
{
create
(
:group
,
:private
)
}
let
(
:group2
)
{
create
(
:group
,
:private
)
}
let
(
:project
)
{
create
(
:project
,
:private
,
group:
group2
)
}
let
(
:project
)
{
create
(
:
empty_
project
,
:private
,
group:
group2
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
before
do
before
do
...
...
spec/controllers/projects/issues_controller_spec.rb
View file @
4642ca66
...
@@ -98,7 +98,7 @@ describe Projects::IssuesController do
...
@@ -98,7 +98,7 @@ describe Projects::IssuesController do
end
end
it
'fills in an issue for a merge request'
do
it
'fills in an issue for a merge request'
do
project_with_repository
=
create
(
:project
)
project_with_repository
=
create
(
:project
,
:repository
)
project_with_repository
.
team
<<
[
user
,
:developer
]
project_with_repository
.
team
<<
[
user
,
:developer
]
mr
=
create
(
:merge_request_with_diff_notes
,
source_project:
project_with_repository
)
mr
=
create
(
:merge_request_with_diff_notes
,
source_project:
project_with_repository
)
...
@@ -124,7 +124,7 @@ describe Projects::IssuesController do
...
@@ -124,7 +124,7 @@ describe Projects::IssuesController do
describe
'PUT #update'
do
describe
'PUT #update'
do
context
'when moving issue to another private project'
do
context
'when moving issue to another private project'
do
let
(
:another_project
)
{
create
(
:project
,
:private
)
}
let
(
:another_project
)
{
create
(
:
empty_
project
,
:private
)
}
before
do
before
do
sign_in
(
user
)
sign_in
(
user
)
...
@@ -466,7 +466,7 @@ describe Projects::IssuesController do
...
@@ -466,7 +466,7 @@ describe Projects::IssuesController do
context
"when the user is owner"
do
context
"when the user is owner"
do
let
(
:owner
)
{
create
(
:user
)
}
let
(
:owner
)
{
create
(
:user
)
}
let
(
:namespace
)
{
create
(
:namespace
,
owner:
owner
)
}
let
(
:namespace
)
{
create
(
:namespace
,
owner:
owner
)
}
let
(
:project
)
{
create
(
:project
,
namespace:
namespace
)
}
let
(
:project
)
{
create
(
:
empty_
project
,
namespace:
namespace
)
}
before
{
sign_in
(
owner
)
}
before
{
sign_in
(
owner
)
}
...
...
spec/controllers/projects/milestones_controller_spec.rb
View file @
4642ca66
require
'spec_helper'
require
'spec_helper'
describe
Projects
::
MilestonesController
do
describe
Projects
::
MilestonesController
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:
empty_
project
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:milestone
)
{
create
(
:milestone
,
project:
project
)
}
let
(
:milestone
)
{
create
(
:milestone
,
project:
project
)
}
let
(
:issue
)
{
create
(
:issue
,
project:
project
,
milestone:
milestone
)
}
let
(
:issue
)
{
create
(
:issue
,
project:
project
,
milestone:
milestone
)
}
...
...
spec/controllers/projects/notes_controller_spec.rb
View file @
4642ca66
...
@@ -2,7 +2,7 @@ require 'spec_helper'
...
@@ -2,7 +2,7 @@ require 'spec_helper'
describe
Projects
::
NotesController
do
describe
Projects
::
NotesController
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:
empty_
project
)
}
let
(
:issue
)
{
create
(
:issue
,
project:
project
)
}
let
(
:issue
)
{
create
(
:issue
,
project:
project
)
}
let
(
:note
)
{
create
(
:note
,
noteable:
issue
,
project:
project
)
}
let
(
:note
)
{
create
(
:note
,
noteable:
issue
,
project:
project
)
}
...
@@ -16,6 +16,7 @@ describe Projects::NotesController do
...
@@ -16,6 +16,7 @@ describe Projects::NotesController do
describe
'POST create'
do
describe
'POST create'
do
let
(
:merge_request
)
{
create
(
:merge_request
)
}
let
(
:merge_request
)
{
create
(
:merge_request
)
}
let
(
:project
)
{
merge_request
.
source_project
}
let
(
:request_params
)
do
let
(
:request_params
)
do
{
{
note:
{
note:
'some note'
,
noteable_id:
merge_request
.
id
,
noteable_type:
'MergeRequest'
},
note:
{
note:
'some note'
,
noteable_id:
merge_request
.
id
,
noteable_type:
'MergeRequest'
},
...
@@ -88,6 +89,7 @@ describe Projects::NotesController do
...
@@ -88,6 +89,7 @@ describe Projects::NotesController do
end
end
describe
"resolving and unresolving"
do
describe
"resolving and unresolving"
do
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:merge_request
)
{
create
(
:merge_request
,
source_project:
project
)
}
let
(
:merge_request
)
{
create
(
:merge_request
,
source_project:
project
)
}
let
(
:note
)
{
create
(
:diff_note_on_merge_request
,
noteable:
merge_request
,
project:
project
)
}
let
(
:note
)
{
create
(
:diff_note_on_merge_request
,
noteable:
merge_request
,
project:
project
)
}
...
...
spec/controllers/projects/project_members_controller_spec.rb
View file @
4642ca66
...
@@ -143,7 +143,7 @@ describe Projects::ProjectMembersController do
...
@@ -143,7 +143,7 @@ describe Projects::ProjectMembersController do
end
end
context
'and is an owner'
do
context
'and is an owner'
do
let
(
:project
)
{
create
(
:project
,
namespace:
user
.
namespace
)
}
let
(
:project
)
{
create
(
:
empty_
project
,
namespace:
user
.
namespace
)
}
before
{
project
.
team
<<
[
user
,
:master
]
}
before
{
project
.
team
<<
[
user
,
:master
]
}
...
@@ -234,7 +234,7 @@ describe Projects::ProjectMembersController do
...
@@ -234,7 +234,7 @@ describe Projects::ProjectMembersController do
end
end
describe
'POST apply_import'
do
describe
'POST apply_import'
do
let
(
:another_project
)
{
create
(
:project
,
:private
)
}
let
(
:another_project
)
{
create
(
:
empty_
project
,
:private
)
}
let
(
:member
)
{
create
(
:user
)
}
let
(
:member
)
{
create
(
:user
)
}
before
do
before
do
...
...
spec/controllers/projects/raw_controller_spec.rb
View file @
4642ca66
require
'spec_helper'
require
'spec_helper'
describe
Projects
::
RawController
do
describe
Projects
::
RawController
do
let
(
:public_project
)
{
create
(
:project
,
:public
)
}
let
(
:public_project
)
{
create
(
:project
,
:public
,
:repository
)
}
describe
"#show"
do
describe
"#show"
do
context
'regular filename'
do
context
'regular filename'
do
...
...
spec/controllers/projects/refs_controller_spec.rb
View file @
4642ca66
require
'spec_helper'
require
'spec_helper'
describe
Projects
::
RefsController
do
describe
Projects
::
RefsController
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
before
do
before
do
...
...
spec/controllers/projects/releases_controller_spec.rb
View file @
4642ca66
require
'spec_helper'
require
'spec_helper'
describe
Projects
::
ReleasesController
do
describe
Projects
::
ReleasesController
do
let!
(
:project
)
{
create
(
:project
)
}
let!
(
:project
)
{
create
(
:project
,
:repository
)
}
let!
(
:user
)
{
create
(
:user
)
}
let!
(
:user
)
{
create
(
:user
)
}
let!
(
:release
)
{
create
(
:release
,
project:
project
)
}
let!
(
:release
)
{
create
(
:release
,
project:
project
)
}
let!
(
:tag
)
{
release
.
tag
}
let!
(
:tag
)
{
release
.
tag
}
...
...
spec/controllers/projects/repositories_controller_spec.rb
View file @
4642ca66
require
"spec_helper"
require
"spec_helper"
describe
Projects
::
RepositoriesController
do
describe
Projects
::
RepositoriesController
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
describe
"GET archive"
do
describe
"GET archive"
do
context
'as a guest'
do
context
'as a guest'
do
...
...
spec/controllers/projects/services_controller_spec.rb
View file @
4642ca66
require
'spec_helper'
require
'spec_helper'
describe
Projects
::
ServicesController
do
describe
Projects
::
ServicesController
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:service
)
{
create
(
:service
,
project:
project
)
}
let
(
:service
)
{
create
(
:service
,
project:
project
)
}
...
...
spec/controllers/projects/settings/integrations_controller_spec.rb
View file @
4642ca66
require
'spec_helper'
require
'spec_helper'
describe
Projects
::
Settings
::
IntegrationsController
do
describe
Projects
::
Settings
::
IntegrationsController
do
let
(
:project
)
{
create
(
:project
,
:public
)
}
let
(
:project
)
{
create
(
:
empty_
project
,
:public
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
before
do
before
do
...
...
spec/controllers/projects/tags_controller_spec.rb
View file @
4642ca66
require
'spec_helper'
require
'spec_helper'
describe
Projects
::
TagsController
do
describe
Projects
::
TagsController
do
let
(
:project
)
{
create
(
:project
,
:public
)
}
let
(
:project
)
{
create
(
:project
,
:public
,
:repository
)
}
let!
(
:release
)
{
create
(
:release
,
project:
project
)
}
let!
(
:release
)
{
create
(
:release
,
project:
project
)
}
let!
(
:invalid_release
)
{
create
(
:release
,
project:
project
,
tag:
'does-not-exist'
)
}
let!
(
:invalid_release
)
{
create
(
:release
,
project:
project
,
tag:
'does-not-exist'
)
}
...
...
spec/controllers/projects/templates_controller_spec.rb
View file @
4642ca66
require
'spec_helper'
require
'spec_helper'
describe
Projects
::
TemplatesController
do
describe
Projects
::
TemplatesController
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:user2
)
{
create
(
:user
)
}
let
(
:user2
)
{
create
(
:user
)
}
let
(
:file_path_1
)
{
'.gitlab/issue_templates/bug.md'
}
let
(
:file_path_1
)
{
'.gitlab/issue_templates/bug.md'
}
...
...
spec/controllers/projects/tree_controller_spec.rb
View file @
4642ca66
require
'spec_helper'
require
'spec_helper'
describe
Projects
::
TreeController
do
describe
Projects
::
TreeController
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
before
do
before
do
...
...
spec/controllers/projects/uploads_controller_spec.rb
View file @
4642ca66
require
(
'spec_helper'
)
require
(
'spec_helper'
)
describe
Projects
::
UploadsController
do
describe
Projects
::
UploadsController
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:
empty_
project
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:jpg
)
{
fixture_file_upload
(
Rails
.
root
+
'spec/fixtures/rails_sample.jpg'
,
'image/jpg'
)
}
let
(
:jpg
)
{
fixture_file_upload
(
Rails
.
root
+
'spec/fixtures/rails_sample.jpg'
,
'image/jpg'
)
}
let
(
:txt
)
{
fixture_file_upload
(
Rails
.
root
+
'spec/fixtures/doc_sample.txt'
,
'text/plain'
)
}
let
(
:txt
)
{
fixture_file_upload
(
Rails
.
root
+
'spec/fixtures/doc_sample.txt'
,
'text/plain'
)
}
...
...
spec/controllers/projects_controller_spec.rb
View file @
4642ca66
require
(
'spec_helper'
)
require
(
'spec_helper'
)
describe
ProjectsController
do
describe
ProjectsController
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:
empty_
project
)
}
let
(
:public_project
)
{
create
(
:project
,
:public
)
}
let
(
:public_project
)
{
create
(
:
empty_
project
,
:public
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:jpg
)
{
fixture_file_upload
(
Rails
.
root
+
'spec/fixtures/rails_sample.jpg'
,
'image/jpg'
)
}
let
(
:jpg
)
{
fixture_file_upload
(
Rails
.
root
+
'spec/fixtures/rails_sample.jpg'
,
'image/jpg'
)
}
let
(
:txt
)
{
fixture_file_upload
(
Rails
.
root
+
'spec/fixtures/doc_sample.txt'
,
'text/plain'
)
}
let
(
:txt
)
{
fixture_file_upload
(
Rails
.
root
+
'spec/fixtures/doc_sample.txt'
,
'text/plain'
)
}
describe
'GET index'
do
describe
'GET index'
do
context
'as a user'
do
context
'as a user'
do
...
@@ -32,7 +32,7 @@ describe ProjectsController do
...
@@ -32,7 +32,7 @@ describe ProjectsController do
before
{
sign_in
(
user
)
}
before
{
sign_in
(
user
)
}
context
"user does not have access to project"
do
context
"user does not have access to project"
do
let
(
:private_project
)
{
create
(
:project
,
:private
)
}
let
(
:private_project
)
{
create
(
:
empty_
project
,
:private
)
}
it
"does not initialize notification setting"
do
it
"does not initialize notification setting"
do
get
:show
,
namespace_id:
private_project
.
namespace
.
path
,
id:
private_project
.
path
get
:show
,
namespace_id:
private_project
.
namespace
.
path
,
id:
private_project
.
path
...
@@ -146,6 +146,8 @@ describe ProjectsController do
...
@@ -146,6 +146,8 @@ describe ProjectsController do
end
end
context
"rendering default project view"
do
context
"rendering default project view"
do
let
(
:public_project
)
{
create
(
:project
,
:public
,
:repository
)
}
render_views
render_views
it
"renders the activity view"
do
it
"renders the activity view"
do
...
@@ -190,25 +192,11 @@ describe ProjectsController do
...
@@ -190,25 +192,11 @@ describe ProjectsController do
expect
(
assigns
(
:project
)).
to
eq
(
public_project
)
expect
(
assigns
(
:project
)).
to
eq
(
public_project
)
expect
(
response
).
to
redirect_to
(
"/
#{
public_project
.
path_with_namespace
}
"
)
expect
(
response
).
to
redirect_to
(
"/
#{
public_project
.
path_with_namespace
}
"
)
end
end
# MySQL queries are case insensitive by default, so this spec would fail.
if
Gitlab
::
Database
.
postgresql?
context
"when there is also a match with the same casing"
do
let!
(
:other_project
)
{
create
(
:project
,
:public
,
namespace:
public_project
.
namespace
,
path:
public_project
.
path
.
upcase
)
}
it
"loads the exactly matched project"
do
get
:show
,
namespace_id:
public_project
.
namespace
.
path
,
id:
public_project
.
path
.
upcase
expect
(
assigns
(
:project
)).
to
eq
(
other_project
)
expect
(
response
).
to
have_http_status
(
200
)
end
end
end
end
end
end
end
context
"when the url contains .atom"
do
context
"when the url contains .atom"
do
let
(
:public_project_with_dot_atom
)
{
build
(
:project
,
:public
,
name:
'my.atom'
,
path:
'my.atom'
)
}
let
(
:public_project_with_dot_atom
)
{
build
(
:
empty_
project
,
:public
,
name:
'my.atom'
,
path:
'my.atom'
)
}
it
'expects an error creating the project'
do
it
'expects an error creating the project'
do
expect
(
public_project_with_dot_atom
).
not_to
be_valid
expect
(
public_project_with_dot_atom
).
not_to
be_valid
...
@@ -217,7 +205,7 @@ describe ProjectsController do
...
@@ -217,7 +205,7 @@ describe ProjectsController do
context
'when the project is pending deletions'
do
context
'when the project is pending deletions'
do
it
'renders a 404 error'
do
it
'renders a 404 error'
do
project
=
create
(
:project
,
pending_delete:
true
)
project
=
create
(
:
empty_
project
,
pending_delete:
true
)
sign_in
(
user
)
sign_in
(
user
)
get
:show
,
namespace_id:
project
.
namespace
.
path
,
id:
project
.
path
get
:show
,
namespace_id:
project
.
namespace
.
path
,
id:
project
.
path
...
@@ -233,6 +221,7 @@ describe ProjectsController do
...
@@ -233,6 +221,7 @@ describe ProjectsController do
let
(
:admin
)
{
create
(
:admin
)
}
let
(
:admin
)
{
create
(
:admin
)
}
it
"sets the repository to the right path after a rename"
do
it
"sets the repository to the right path after a rename"
do
project
=
create
(
:project
,
:repository
)
new_path
=
'renamed_path'
new_path
=
'renamed_path'
project_params
=
{
path:
new_path
}
project_params
=
{
path:
new_path
}
controller
.
instance_variable_set
(
:@project
,
project
)
controller
.
instance_variable_set
(
:@project
,
project
)
...
@@ -384,6 +373,8 @@ describe ProjectsController do
...
@@ -384,6 +373,8 @@ describe ProjectsController do
end
end
describe
"GET refs"
do
describe
"GET refs"
do
let
(
:public_project
)
{
create
(
:project
,
:public
)
}
it
"gets a list of branches and tags"
do
it
"gets a list of branches and tags"
do
get
:refs
,
namespace_id:
public_project
.
namespace
.
path
,
id:
public_project
.
path
get
:refs
,
namespace_id:
public_project
.
namespace
.
path
,
id:
public_project
.
path
...
...
spec/controllers/uploads_controller_spec.rb
View file @
4642ca66
...
@@ -41,7 +41,7 @@ describe UploadsController do
...
@@ -41,7 +41,7 @@ describe UploadsController do
end
end
context
"when viewing a project avatar"
do
context
"when viewing a project avatar"
do
let!
(
:project
)
{
create
(
:project
,
avatar:
fixture_file_upload
(
Rails
.
root
+
"spec/fixtures/dk.png"
,
"image/png"
))
}
let!
(
:project
)
{
create
(
:
empty_
project
,
avatar:
fixture_file_upload
(
Rails
.
root
+
"spec/fixtures/dk.png"
,
"image/png"
))
}
context
"when the project is public"
do
context
"when the project is public"
do
before
do
before
do
...
...
spec/controllers/users_controller_spec.rb
View file @
4642ca66
...
@@ -73,7 +73,7 @@ describe UsersController do
...
@@ -73,7 +73,7 @@ describe UsersController do
end
end
context
'forked project'
do
context
'forked project'
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:
empty_
project
)
}
let
(
:forked_project
)
{
Projects
::
ForkService
.
new
(
project
,
user
).
execute
}
let
(
:forked_project
)
{
Projects
::
ForkService
.
new
(
project
,
user
).
execute
}
before
do
before
do
...
@@ -91,7 +91,7 @@ describe UsersController do
...
@@ -91,7 +91,7 @@ describe UsersController do
end
end
describe
'GET #calendar_activities'
do
describe
'GET #calendar_activities'
do
let!
(
:project
)
{
create
(
:project
)
}
let!
(
:project
)
{
create
(
:
empty_
project
)
}
let!
(
:user
)
{
create
(
:user
)
}
let!
(
:user
)
{
create
(
:user
)
}
before
do
before
do
...
...
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