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
1897fb00
Commit
1897fb00
authored
Mar 19, 2014
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make use of project factory traits
parent
65d63470
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
42 additions
and
54 deletions
+42
-54
features/steps/project/redirects.rb
features/steps/project/redirects.rb
+1
-1
features/steps/public/projects.rb
features/steps/public/projects.rb
+1
-1
features/steps/shared/project.rb
features/steps/shared/project.rb
+4
-4
spec/features/security/group/internal_group_access_spec.rb
spec/features/security/group/internal_group_access_spec.rb
+1
-1
spec/features/security/group/mixed_group_access_spec.rb
spec/features/security/group/mixed_group_access_spec.rb
+2
-2
spec/features/security/group/public_group_access_spec.rb
spec/features/security/group/public_group_access_spec.rb
+1
-1
spec/features/security/project/internal_access_spec.rb
spec/features/security/project/internal_access_spec.rb
+1
-6
spec/finders/projects_finder_spec.rb
spec/finders/projects_finder_spec.rb
+4
-4
spec/requests/api/projects_spec.rb
spec/requests/api/projects_spec.rb
+14
-14
spec/services/search_service_spec.rb
spec/services/search_service_spec.rb
+13
-20
No files found.
features/steps/project/redirects.rb
View file @
1897fb00
...
@@ -4,7 +4,7 @@ class Spinach::Features::ProjectRedirects < Spinach::FeatureSteps
...
@@ -4,7 +4,7 @@ class Spinach::Features::ProjectRedirects < Spinach::FeatureSteps
include
SharedProject
include
SharedProject
step
'public project "Community"'
do
step
'public project "Community"'
do
create
:project
,
name:
'Community'
,
visibility_level:
Gitlab
::
VisibilityLevel
::
PUBLIC
create
:project
,
:public
,
name:
'Community'
end
end
step
'private project "Enterprise"'
do
step
'private project "Enterprise"'
do
...
...
features/steps/public/projects.rb
View file @
1897fb00
...
@@ -4,7 +4,7 @@ class Spinach::Features::PublicProjectsFeature < Spinach::FeatureSteps
...
@@ -4,7 +4,7 @@ class Spinach::Features::PublicProjectsFeature < Spinach::FeatureSteps
include
SharedProject
include
SharedProject
step
'public empty project "Empty Public Project"'
do
step
'public empty project "Empty Public Project"'
do
create
:empty_project
,
name:
'Empty Public Project'
,
visibility_level:
Gitlab
::
VisibilityLevel
::
PUBLIC
create
:empty_project
,
:public
,
name:
'Empty Public Project'
end
end
step
'I should see project "Empty Public Project"'
do
step
'I should see project "Empty Public Project"'
do
...
...
features/steps/shared/project.rb
View file @
1897fb00
...
@@ -79,7 +79,7 @@ module SharedProject
...
@@ -79,7 +79,7 @@ module SharedProject
end
end
step
'internal project "Internal"'
do
step
'internal project "Internal"'
do
create
:project
,
name:
'Internal'
,
visibility_level:
Gitlab
::
VisibilityLevel
::
INTERNAL
create
:project
,
:internal
,
name:
'Internal'
end
end
step
'I should see project "Internal"'
do
step
'I should see project "Internal"'
do
...
@@ -91,7 +91,7 @@ module SharedProject
...
@@ -91,7 +91,7 @@ module SharedProject
end
end
step
'public project "Community"'
do
step
'public project "Community"'
do
create
:project
,
name:
'Community'
,
visibility_level:
Gitlab
::
VisibilityLevel
::
PUBLIC
create
:project
,
:public
,
name:
'Community'
end
end
step
'I should see project "Community"'
do
step
'I should see project "Community"'
do
...
@@ -112,14 +112,14 @@ module SharedProject
...
@@ -112,14 +112,14 @@ module SharedProject
step
'"John Doe" is authorized to internal project "Internal"'
do
step
'"John Doe" is authorized to internal project "Internal"'
do
user
=
user_exists
(
"John Doe"
,
username:
"john_doe"
)
user
=
user_exists
(
"John Doe"
,
username:
"john_doe"
)
project
=
Project
.
find_by
(
name:
"Internal"
)
project
=
Project
.
find_by
(
name:
"Internal"
)
project
||=
create
:project
,
name:
'Internal'
,
visibility_level:
Gitlab
::
VisibilityLevel
::
INTERNAL
project
||=
create
:project
,
:internal
,
name:
'Internal'
project
.
team
<<
[
user
,
:master
]
project
.
team
<<
[
user
,
:master
]
end
end
step
'"John Doe" is authorized to public project "Community"'
do
step
'"John Doe" is authorized to public project "Community"'
do
user
=
user_exists
(
"John Doe"
,
username:
"john_doe"
)
user
=
user_exists
(
"John Doe"
,
username:
"john_doe"
)
project
=
Project
.
find_by
(
name:
"Community"
)
project
=
Project
.
find_by
(
name:
"Community"
)
project
||=
create
:project
,
name:
'Community'
,
visibility_level:
Gitlab
::
VisibilityLevel
::
PUBLIC
project
||=
create
:project
,
:public
,
name:
'Community'
project
.
team
<<
[
user
,
:master
]
project
.
team
<<
[
user
,
:master
]
end
end
end
end
spec/features/security/group/internal_group_access_spec.rb
View file @
1897fb00
...
@@ -16,7 +16,7 @@ describe "Group with internal project access" do
...
@@ -16,7 +16,7 @@ describe "Group with internal project access" do
group
.
add_user
(
reporter
,
Gitlab
::
Access
::
REPORTER
)
group
.
add_user
(
reporter
,
Gitlab
::
Access
::
REPORTER
)
group
.
add_user
(
guest
,
Gitlab
::
Access
::
GUEST
)
group
.
add_user
(
guest
,
Gitlab
::
Access
::
GUEST
)
create
(
:project
,
group:
group
,
visibility_level:
Gitlab
::
VisibilityLevel
::
INTERNAL
)
create
(
:project
,
:internal
,
group:
group
)
end
end
describe
"GET /groups/:path"
do
describe
"GET /groups/:path"
do
...
...
spec/features/security/group/mixed_group_access_spec.rb
View file @
1897fb00
...
@@ -16,8 +16,8 @@ describe "Group access" do
...
@@ -16,8 +16,8 @@ describe "Group access" do
group
.
add_user
(
reporter
,
Gitlab
::
Access
::
REPORTER
)
group
.
add_user
(
reporter
,
Gitlab
::
Access
::
REPORTER
)
group
.
add_user
(
guest
,
Gitlab
::
Access
::
GUEST
)
group
.
add_user
(
guest
,
Gitlab
::
Access
::
GUEST
)
create
(
:project
,
path:
"internal_project"
,
group:
group
,
visibility_level:
Gitlab
::
VisibilityLevel
::
INTERNAL
)
create
(
:project
,
:internal
,
path:
"internal_project"
,
group:
group
)
create
(
:project
,
path:
"public_project"
,
group:
group
,
visibility_level:
Gitlab
::
VisibilityLevel
::
PUBLIC
)
create
(
:project
,
:public
,
path:
"public_project"
,
group:
group
)
end
end
describe
"GET /groups/:path"
do
describe
"GET /groups/:path"
do
...
...
spec/features/security/group/public_group_access_spec.rb
View file @
1897fb00
...
@@ -16,7 +16,7 @@ describe "Group with public project access" do
...
@@ -16,7 +16,7 @@ describe "Group with public project access" do
group
.
add_user
(
reporter
,
Gitlab
::
Access
::
REPORTER
)
group
.
add_user
(
reporter
,
Gitlab
::
Access
::
REPORTER
)
group
.
add_user
(
guest
,
Gitlab
::
Access
::
GUEST
)
group
.
add_user
(
guest
,
Gitlab
::
Access
::
GUEST
)
create
(
:project
,
group:
group
,
visibility_level:
Gitlab
::
VisibilityLevel
::
PUBLIC
)
create
(
:project
,
:public
,
group:
group
)
end
end
describe
"GET /groups/:path"
do
describe
"GET /groups/:path"
do
...
...
spec/features/security/project/internal_access_spec.rb
View file @
1897fb00
require
'spec_helper'
require
'spec_helper'
describe
"Internal Project Access"
do
describe
"Internal Project Access"
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
:internal
)
}
let
(
:master
)
{
create
(
:user
)
}
let
(
:master
)
{
create
(
:user
)
}
let
(
:guest
)
{
create
(
:user
)
}
let
(
:guest
)
{
create
(
:user
)
}
let
(
:reporter
)
{
create
(
:user
)
}
let
(
:reporter
)
{
create
(
:user
)
}
before
do
before
do
# internal project
project
.
visibility_level
=
Gitlab
::
VisibilityLevel
::
INTERNAL
project
.
save!
# full access
# full access
project
.
team
<<
[
master
,
:master
]
project
.
team
<<
[
master
,
:master
]
# readonly
# readonly
project
.
team
<<
[
reporter
,
:reporter
]
project
.
team
<<
[
reporter
,
:reporter
]
end
end
describe
"Project should be internal"
do
describe
"Project should be internal"
do
...
...
spec/finders/projects_finder_spec.rb
View file @
1897fb00
...
@@ -4,10 +4,10 @@ describe ProjectsFinder do
...
@@ -4,10 +4,10 @@ describe ProjectsFinder do
let
(
:user
)
{
create
:user
}
let
(
:user
)
{
create
:user
}
let
(
:group
)
{
create
:group
}
let
(
:group
)
{
create
:group
}
let
(
:project1
)
{
create
(
:empty_project
,
group:
group
,
visibility_level:
Project
::
PUBLIC
)
}
let
(
:project1
)
{
create
(
:empty_project
,
:public
,
group:
group
)
}
let
(
:project2
)
{
create
(
:empty_project
,
group:
group
,
visibility_level:
Project
::
INTERNAL
)
}
let
(
:project2
)
{
create
(
:empty_project
,
:internal
,
group:
group
)
}
let
(
:project3
)
{
create
(
:empty_project
,
group:
group
,
visibility_level:
Project
::
PRIVATE
)
}
let
(
:project3
)
{
create
(
:empty_project
,
:private
,
group:
group
)
}
let
(
:project4
)
{
create
(
:empty_project
,
group:
group
,
visibility_level:
Project
::
PRIVATE
)
}
let
(
:project4
)
{
create
(
:empty_project
,
:private
,
group:
group
)
}
context
'non authenticated'
do
context
'non authenticated'
do
subject
{
ProjectsFinder
.
new
.
execute
(
nil
,
group:
group
)
}
subject
{
ProjectsFinder
.
new
.
execute
(
nil
,
group:
group
)
}
...
...
spec/requests/api/projects_spec.rb
View file @
1897fb00
...
@@ -133,7 +133,7 @@ describe API::API do
...
@@ -133,7 +133,7 @@ describe API::API do
end
end
it
"should set a project as public"
do
it
"should set a project as public"
do
project
=
attributes_for
(
:project
,
{
visibility_level:
Gitlab
::
VisibilityLevel
::
PUBLIC
}
)
project
=
attributes_for
(
:project
,
:public
)
post
api
(
"/projects"
,
user
),
project
post
api
(
"/projects"
,
user
),
project
json_response
[
'public'
].
should
be_true
json_response
[
'public'
].
should
be_true
json_response
[
'visibility_level'
].
should
==
Gitlab
::
VisibilityLevel
::
PUBLIC
json_response
[
'visibility_level'
].
should
==
Gitlab
::
VisibilityLevel
::
PUBLIC
...
@@ -147,21 +147,21 @@ describe API::API do
...
@@ -147,21 +147,21 @@ describe API::API do
end
end
it
"should set a project as internal"
do
it
"should set a project as internal"
do
project
=
attributes_for
(
:project
,
{
visibility_level:
Gitlab
::
VisibilityLevel
::
INTERNAL
}
)
project
=
attributes_for
(
:project
,
:internal
)
post
api
(
"/projects"
,
user
),
project
post
api
(
"/projects"
,
user
),
project
json_response
[
'public'
].
should
be_false
json_response
[
'public'
].
should
be_false
json_response
[
'visibility_level'
].
should
==
Gitlab
::
VisibilityLevel
::
INTERNAL
json_response
[
'visibility_level'
].
should
==
Gitlab
::
VisibilityLevel
::
INTERNAL
end
end
it
"should set a project as internal overriding :public"
do
it
"should set a project as internal overriding :public"
do
project
=
attributes_for
(
:project
,
{
public:
true
,
visibility_level:
Gitlab
::
VisibilityLevel
::
INTERNAL
})
project
=
attributes_for
(
:project
,
:internal
,
{
public:
true
})
post
api
(
"/projects"
,
user
),
project
post
api
(
"/projects"
,
user
),
project
json_response
[
'public'
].
should
be_false
json_response
[
'public'
].
should
be_false
json_response
[
'visibility_level'
].
should
==
Gitlab
::
VisibilityLevel
::
INTERNAL
json_response
[
'visibility_level'
].
should
==
Gitlab
::
VisibilityLevel
::
INTERNAL
end
end
it
"should set a project as private"
do
it
"should set a project as private"
do
project
=
attributes_for
(
:project
,
{
visibility_level:
Gitlab
::
VisibilityLevel
::
PRIVATE
}
)
project
=
attributes_for
(
:project
,
:private
)
post
api
(
"/projects"
,
user
),
project
post
api
(
"/projects"
,
user
),
project
json_response
[
'public'
].
should
be_false
json_response
[
'public'
].
should
be_false
json_response
[
'visibility_level'
].
should
==
Gitlab
::
VisibilityLevel
::
PRIVATE
json_response
[
'visibility_level'
].
should
==
Gitlab
::
VisibilityLevel
::
PRIVATE
...
@@ -215,7 +215,7 @@ describe API::API do
...
@@ -215,7 +215,7 @@ describe API::API do
end
end
it
"should set a project as public"
do
it
"should set a project as public"
do
project
=
attributes_for
(
:project
,
{
visibility_level:
Gitlab
::
VisibilityLevel
::
PUBLIC
}
)
project
=
attributes_for
(
:project
,
:public
)
post
api
(
"/projects/user/
#{
user
.
id
}
"
,
admin
),
project
post
api
(
"/projects/user/
#{
user
.
id
}
"
,
admin
),
project
json_response
[
'public'
].
should
be_true
json_response
[
'public'
].
should
be_true
json_response
[
'visibility_level'
].
should
==
Gitlab
::
VisibilityLevel
::
PUBLIC
json_response
[
'visibility_level'
].
should
==
Gitlab
::
VisibilityLevel
::
PUBLIC
...
@@ -229,21 +229,21 @@ describe API::API do
...
@@ -229,21 +229,21 @@ describe API::API do
end
end
it
"should set a project as internal"
do
it
"should set a project as internal"
do
project
=
attributes_for
(
:project
,
{
visibility_level:
Gitlab
::
VisibilityLevel
::
INTERNAL
}
)
project
=
attributes_for
(
:project
,
:internal
)
post
api
(
"/projects/user/
#{
user
.
id
}
"
,
admin
),
project
post
api
(
"/projects/user/
#{
user
.
id
}
"
,
admin
),
project
json_response
[
'public'
].
should
be_false
json_response
[
'public'
].
should
be_false
json_response
[
'visibility_level'
].
should
==
Gitlab
::
VisibilityLevel
::
INTERNAL
json_response
[
'visibility_level'
].
should
==
Gitlab
::
VisibilityLevel
::
INTERNAL
end
end
it
"should set a project as internal overriding :public"
do
it
"should set a project as internal overriding :public"
do
project
=
attributes_for
(
:project
,
{
public:
true
,
visibility_level:
Gitlab
::
VisibilityLevel
::
INTERNAL
})
project
=
attributes_for
(
:project
,
:internal
,
{
public:
true
})
post
api
(
"/projects/user/
#{
user
.
id
}
"
,
admin
),
project
post
api
(
"/projects/user/
#{
user
.
id
}
"
,
admin
),
project
json_response
[
'public'
].
should
be_false
json_response
[
'public'
].
should
be_false
json_response
[
'visibility_level'
].
should
==
Gitlab
::
VisibilityLevel
::
INTERNAL
json_response
[
'visibility_level'
].
should
==
Gitlab
::
VisibilityLevel
::
INTERNAL
end
end
it
"should set a project as private"
do
it
"should set a project as private"
do
project
=
attributes_for
(
:project
,
{
visibility_level:
Gitlab
::
VisibilityLevel
::
PRIVATE
}
)
project
=
attributes_for
(
:project
,
:private
)
post
api
(
"/projects/user/
#{
user
.
id
}
"
,
admin
),
project
post
api
(
"/projects/user/
#{
user
.
id
}
"
,
admin
),
project
json_response
[
'public'
].
should
be_false
json_response
[
'public'
].
should
be_false
json_response
[
'visibility_level'
].
should
==
Gitlab
::
VisibilityLevel
::
PRIVATE
json_response
[
'visibility_level'
].
should
==
Gitlab
::
VisibilityLevel
::
PRIVATE
...
@@ -490,10 +490,10 @@ describe API::API do
...
@@ -490,10 +490,10 @@ describe API::API do
describe
:fork_admin
do
describe
:fork_admin
do
let
(
:project_fork_target
)
{
create
(
:project
)
}
let
(
:project_fork_target
)
{
create
(
:project
)
}
let
(
:project_fork_source
)
{
create
(
:project
,
visibility_level:
Gitlab
::
VisibilityLevel
::
PUBLIC
)
}
let
(
:project_fork_source
)
{
create
(
:project
,
:public
)
}
describe
"POST /projects/:id/fork/:forked_from_id"
do
describe
"POST /projects/:id/fork/:forked_from_id"
do
let
(
:new_project_fork_source
)
{
create
(
:project
,
visibility_level:
Gitlab
::
VisibilityLevel
::
PUBLIC
)
}
let
(
:new_project_fork_source
)
{
create
(
:project
,
:public
)
}
it
"shouldn't available for non admin users"
do
it
"shouldn't available for non admin users"
do
post
api
(
"/projects/
#{
project_fork_target
.
id
}
/fork/
#{
project_fork_source
.
id
}
"
,
user
)
post
api
(
"/projects/
#{
project_fork_target
.
id
}
/fork/
#{
project_fork_source
.
id
}
"
,
user
)
...
@@ -562,10 +562,10 @@ describe API::API do
...
@@ -562,10 +562,10 @@ describe API::API do
let!
(
:post
)
{
create
(
:empty_project
,
name:
"
#{
query
}
_post"
,
creator_id:
user
.
id
,
namespace:
user
.
namespace
)
}
let!
(
:post
)
{
create
(
:empty_project
,
name:
"
#{
query
}
_post"
,
creator_id:
user
.
id
,
namespace:
user
.
namespace
)
}
let!
(
:pre_post
)
{
create
(
:empty_project
,
name:
"pre_
#{
query
}
_post"
,
creator_id:
user
.
id
,
namespace:
user
.
namespace
)
}
let!
(
:pre_post
)
{
create
(
:empty_project
,
name:
"pre_
#{
query
}
_post"
,
creator_id:
user
.
id
,
namespace:
user
.
namespace
)
}
let!
(
:unfound
)
{
create
(
:empty_project
,
name:
'unfound'
,
creator_id:
user
.
id
,
namespace:
user
.
namespace
)
}
let!
(
:unfound
)
{
create
(
:empty_project
,
name:
'unfound'
,
creator_id:
user
.
id
,
namespace:
user
.
namespace
)
}
let!
(
:internal
)
{
create
(
:empty_project
,
name:
"internal
#{
query
}
"
,
visibility_level:
Gitlab
::
VisibilityLevel
::
INTERNAL
)
}
let!
(
:internal
)
{
create
(
:empty_project
,
:internal
,
name:
"internal
#{
query
}
"
)
}
let!
(
:unfound_internal
)
{
create
(
:empty_project
,
name:
'unfound internal'
,
visibility_level:
Gitlab
::
VisibilityLevel
::
INTERNAL
)
}
let!
(
:unfound_internal
)
{
create
(
:empty_project
,
:internal
,
name:
'unfound internal'
)
}
let!
(
:public
)
{
create
(
:empty_project
,
name:
"public
#{
query
}
"
,
visibility_level:
Gitlab
::
VisibilityLevel
::
PUBLIC
)
}
let!
(
:public
)
{
create
(
:empty_project
,
:public
,
name:
"public
#{
query
}
"
)
}
let!
(
:unfound_public
)
{
create
(
:empty_project
,
name:
'unfound public'
,
visibility_level:
Gitlab
::
VisibilityLevel
::
PUBLIC
)
}
let!
(
:unfound_public
)
{
create
(
:empty_project
,
:public
,
name:
'unfound public'
)
}
context
"when unauthenticated"
do
context
"when unauthenticated"
do
it
"should return authentication error"
do
it
"should return authentication error"
do
...
...
spec/services/search_service_spec.rb
View file @
1897fb00
require
'spec_helper'
require
'spec_helper'
describe
'Search::GlobalService'
do
describe
'Search::GlobalService'
do
let
(
:found_namespace
)
{
create
(
:namespace
,
name:
'searchable namespace'
,
path
:'another_thing'
)
}
let
(
:user
)
{
create
(
:user
,
namespace:
found_namespace
)
}
let
(
:user
)
{
create
(
:user
,
namespace:
found_namespace
)
}
let!
(
:found_project
)
{
create
(
:project
,
name:
'searchable_project'
,
creator_id:
user
.
id
,
namespace:
found_namespace
,
visibility_level:
Gitlab
::
VisibilityLevel
::
PRIVATE
)
}
let
(
:public_user
)
{
create
(
:user
,
namespace:
public_namespace
)
}
let
(
:internal_user
)
{
create
(
:user
,
namespace:
internal_namespace
)
}
let
(
:found_namespace
)
{
create
(
:namespace
,
name:
'searchable namespace'
,
path
:'another_thing'
)
}
let
(
:unfound_namespace
)
{
create
(
:namespace
,
name:
'unfound namespace'
,
path:
'yet_something_else'
)
}
let
(
:unfound_namespace
)
{
create
(
:namespace
,
name:
'unfound namespace'
,
path:
'yet_something_else'
)
}
let!
(
:unfound_project
)
{
create
(
:project
,
name:
'unfound_project'
,
creator_id:
user
.
id
,
namespace:
unfound_namespace
,
visibility_level:
Gitlab
::
VisibilityLevel
::
PRIVATE
)
}
let
(
:internal_namespace
)
{
create
(
:namespace
,
name:
'searchable internal namespace'
,
path:
'something_internal'
)
}
let
(
:public_namespace
)
{
create
(
:namespace
,
name:
'searchable public namespace'
,
path:
'something_public'
)
}
let
(
:internal_namespace
)
{
create
(
:namespace
,
path:
'something_internal'
,
name:
'searchable internal namespace'
)
}
let!
(
:found_project
)
{
create
(
:project
,
:private
,
name:
'searchable_project'
,
creator_id:
user
.
id
,
namespace:
found_namespace
)
}
let
(
:internal_user
)
{
create
(
:user
,
namespace:
internal_namespace
)
}
let!
(
:unfound_project
)
{
create
(
:project
,
:private
,
name:
'unfound_project'
,
creator_id:
user
.
id
,
namespace:
unfound_namespace
)
}
let!
(
:internal_project
)
{
create
(
:project
,
name:
'searchable_internal_project'
,
creator_id:
internal_user
.
id
,
namespace:
internal_namespace
,
visibility_level:
Gitlab
::
VisibilityLevel
::
INTERNAL
)
}
let!
(
:internal_project
)
{
create
(
:project
,
:internal
,
name:
'searchable_internal_project'
,
creator_id:
internal_user
.
id
,
namespace:
internal_namespace
)
}
let!
(
:public_project
)
{
create
(
:project
,
:public
,
name:
'searchable_public_project'
,
creator_id:
public_user
.
id
,
namespace:
public_namespace
)
}
let
(
:public_namespace
)
{
create
(
:namespace
,
path:
'something_public'
,
name:
'searchable public namespace'
)
}
let
(
:public_user
)
{
create
(
:user
,
namespace:
public_namespace
)
}
let!
(
:public_project
)
{
create
(
:project
,
name:
'searchable_public_project'
,
creator_id:
public_user
.
id
,
namespace:
public_namespace
,
visibility_level:
Gitlab
::
VisibilityLevel
::
PUBLIC
)
}
describe
'#execute'
do
describe
'#execute'
do
context
'unauthenticated'
do
context
'unauthenticated'
do
it
'should return public projects only'
do
it
'should return public projects only'
do
context
=
Search
::
GlobalService
.
new
(
nil
,
search:
"searchable"
)
context
=
Search
::
GlobalService
.
new
(
nil
,
search:
"searchable"
)
results
=
context
.
execute
results
=
context
.
execute
results
[
:projects
].
should
have
(
1
).
items
results
[
:projects
].
should
match_array
[
public_project
]
results
[
:projects
].
should
include
(
public_project
)
end
end
end
end
...
@@ -30,24 +28,19 @@ describe 'Search::GlobalService' do
...
@@ -30,24 +28,19 @@ describe 'Search::GlobalService' do
it
'should return public, internal and private projects'
do
it
'should return public, internal and private projects'
do
context
=
Search
::
GlobalService
.
new
(
user
,
search:
"searchable"
)
context
=
Search
::
GlobalService
.
new
(
user
,
search:
"searchable"
)
results
=
context
.
execute
results
=
context
.
execute
results
[
:projects
].
should
have
(
3
).
items
results
[
:projects
].
should
match_array
[
public_project
,
found_project
,
internal_project
]
results
[
:projects
].
should
include
(
public_project
)
results
[
:projects
].
should
include
(
found_project
)
results
[
:projects
].
should
include
(
internal_project
)
end
end
it
'should return only public & internal projects'
do
it
'should return only public & internal projects'
do
context
=
Search
::
GlobalService
.
new
(
internal_user
,
search:
"searchable"
)
context
=
Search
::
GlobalService
.
new
(
internal_user
,
search:
"searchable"
)
results
=
context
.
execute
results
=
context
.
execute
results
[
:projects
].
should
have
(
2
).
items
results
[
:projects
].
should
match_array
[
internal_project
,
public_project
]
results
[
:projects
].
should
include
(
internal_project
)
results
[
:projects
].
should
include
(
public_project
)
end
end
it
'namespace name should be searchable'
do
it
'namespace name should be searchable'
do
context
=
Search
::
GlobalService
.
new
(
user
,
search:
"searchable namespace"
)
context
=
Search
::
GlobalService
.
new
(
user
,
search:
"searchable namespace"
)
results
=
context
.
execute
results
=
context
.
execute
results
[
:projects
].
should
==
[
found_project
]
results
[
:projects
].
should
match_array
[
found_project
]
end
end
end
end
end
end
...
...
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