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
Kazuhiko Shiozaki
gitlab-ce
Commits
0a2a34a4
Commit
0a2a34a4
authored
Sep 26, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ignore owner_id for Group in tests
parent
65b9768c
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
36 additions
and
21 deletions
+36
-21
features/steps/group/group.rb
features/steps/group/group.rb
+2
-1
spec/contexts/projects_create_context_spec.rb
spec/contexts/projects_create_context_spec.rb
+4
-2
spec/factories.rb
spec/factories.rb
+0
-1
spec/features/security/group_access_spec.rb
spec/features/security/group_access_spec.rb
+7
-5
spec/models/group_spec.rb
spec/models/group_spec.rb
+3
-3
spec/models/project_spec.rb
spec/models/project_spec.rb
+0
-1
spec/models/user_spec.rb
spec/models/user_spec.rb
+6
-4
spec/requests/api/groups_spec.rb
spec/requests/api/groups_spec.rb
+14
-4
No files found.
features/steps/group/group.rb
View file @
0a2a34a4
...
...
@@ -10,7 +10,8 @@ class Groups < Spinach::FeatureSteps
end
And
'I have group with projects'
do
@group
=
create
(
:group
,
owner:
current_user
)
@group
=
create
(
:group
)
@group
.
add_owner
(
current_user
)
@project
=
create
(
:project
,
namespace:
@group
)
@event
=
create
(
:closed_issue_event
,
project:
@project
)
...
...
spec/contexts/projects_create_context_spec.rb
View file @
0a2a34a4
...
...
@@ -25,13 +25,15 @@ describe Projects::CreateContext do
context
'group namespace'
do
before
do
@group
=
create
:group
,
owner:
@user
@group
=
create
:group
@group
.
add_owner
(
@user
)
@opts
.
merge!
(
namespace_id:
@group
.
id
)
@project
=
create_project
(
@user
,
@opts
)
end
it
{
@project
.
should
be_valid
}
it
{
@project
.
owner
.
should
==
@
user
}
it
{
@project
.
owner
.
should
==
@
group
}
it
{
@project
.
namespace
.
should
==
@group
}
end
...
...
spec/factories.rb
View file @
0a2a34a4
...
...
@@ -71,7 +71,6 @@ FactoryGirl.define do
factory
:group
do
sequence
(
:name
)
{
|
n
|
"group
#{
n
}
"
}
path
{
name
.
downcase
.
gsub
(
/\s/
,
'_'
)
}
owner
type
'Group'
end
...
...
spec/features/security/group_access_spec.rb
View file @
0a2a34a4
...
...
@@ -10,11 +10,13 @@ describe "Group access" do
describe
"Group"
do
let
(
:group
)
{
create
(
:group
)
}
let
(
:owner
)
{
create
(
:owner
)
}
let
(
:master
)
{
create
(
:user
)
}
let
(
:reporter
)
{
create
(
:user
)
}
let
(
:guest
)
{
create
(
:user
)
}
before
do
group
.
add_user
(
owner
,
Gitlab
::
Access
::
OWNER
)
group
.
add_user
(
master
,
Gitlab
::
Access
::
MASTER
)
group
.
add_user
(
reporter
,
Gitlab
::
Access
::
REPORTER
)
group
.
add_user
(
guest
,
Gitlab
::
Access
::
GUEST
)
...
...
@@ -23,7 +25,7 @@ describe "Group access" do
describe
"GET /groups/:path"
do
subject
{
group_path
(
group
)
}
it
{
should
be_allowed_for
group
.
owner
}
it
{
should
be_allowed_for
owner
}
it
{
should
be_allowed_for
master
}
it
{
should
be_allowed_for
reporter
}
it
{
should
be_allowed_for
:admin
}
...
...
@@ -35,7 +37,7 @@ describe "Group access" do
describe
"GET /groups/:path/issues"
do
subject
{
issues_group_path
(
group
)
}
it
{
should
be_allowed_for
group
.
owner
}
it
{
should
be_allowed_for
owner
}
it
{
should
be_allowed_for
master
}
it
{
should
be_allowed_for
reporter
}
it
{
should
be_allowed_for
:admin
}
...
...
@@ -47,7 +49,7 @@ describe "Group access" do
describe
"GET /groups/:path/merge_requests"
do
subject
{
merge_requests_group_path
(
group
)
}
it
{
should
be_allowed_for
group
.
owner
}
it
{
should
be_allowed_for
owner
}
it
{
should
be_allowed_for
master
}
it
{
should
be_allowed_for
reporter
}
it
{
should
be_allowed_for
:admin
}
...
...
@@ -59,7 +61,7 @@ describe "Group access" do
describe
"GET /groups/:path/members"
do
subject
{
members_group_path
(
group
)
}
it
{
should
be_allowed_for
group
.
owner
}
it
{
should
be_allowed_for
owner
}
it
{
should
be_allowed_for
master
}
it
{
should
be_allowed_for
reporter
}
it
{
should
be_allowed_for
:admin
}
...
...
@@ -71,7 +73,7 @@ describe "Group access" do
describe
"GET /groups/:path/edit"
do
subject
{
edit_group_path
(
group
)
}
it
{
should
be_allowed_for
group
.
owner
}
it
{
should
be_allowed_for
owner
}
it
{
should
be_denied_for
master
}
it
{
should
be_denied_for
reporter
}
it
{
should
be_allowed_for
:admin
}
...
...
spec/models/group_spec.rb
View file @
0a2a34a4
...
...
@@ -26,10 +26,10 @@ describe Group do
it
{
should
validate_uniqueness_of
(
:name
)
}
it
{
should
validate_presence_of
:path
}
it
{
should
validate_uniqueness_of
(
:path
)
}
it
{
should
validate_presence_of
:owner
}
it
{
should
_not
validate_presence_of
:owner
}
describe
:users
do
it
{
group
.
users
.
should
==
[
group
.
owner
]
}
it
{
group
.
users
.
should
==
group
.
owners
}
end
describe
:human_name
do
...
...
@@ -38,7 +38,7 @@ describe Group do
describe
:add_users
do
let
(
:user
)
{
create
(
:user
)
}
before
{
group
.
add_user
s
([
user
.
id
]
,
UsersGroup
::
MASTER
)
}
before
{
group
.
add_user
(
user
,
UsersGroup
::
MASTER
)
}
it
{
group
.
users_groups
.
masters
.
map
(
&
:user
).
should
include
(
user
)
}
end
...
...
spec/models/project_spec.rb
View file @
0a2a34a4
...
...
@@ -85,7 +85,6 @@ describe Project do
it
{
should
respond_to
(
:execute_hooks
)
}
it
{
should
respond_to
(
:transfer
)
}
it
{
should
respond_to
(
:name_with_namespace
)
}
it
{
should
respond_to
(
:namespace_owner
)
}
it
{
should
respond_to
(
:owner
)
}
it
{
should
respond_to
(
:path_with_namespace
)
}
end
...
...
spec/models/user_spec.rb
View file @
0a2a34a4
...
...
@@ -130,11 +130,12 @@ describe User do
before
do
ActiveRecord
::
Base
.
observers
.
enable
(
:user_observer
)
@user
=
create
:user
@group
=
create
:group
,
owner:
@user
@group
=
create
:group
@group
.
add_owner
(
@user
)
end
it
{
@user
.
several_namespaces?
.
should
be_true
}
it
{
@user
.
namespaces
.
should
include
(
@user
.
namespace
,
@group
)
}
it
{
@user
.
namespaces
.
should
include
(
@user
.
namespace
)
}
it
{
@user
.
authorized_groups
.
should
==
[
@group
]
}
it
{
@user
.
owned_groups
.
should
==
[
@group
]
}
end
...
...
@@ -144,9 +145,10 @@ describe User do
ActiveRecord
::
Base
.
observers
.
enable
(
:user_observer
)
@user
=
create
:user
@user2
=
create
:user
@group
=
create
:group
,
owner:
@user
@group
=
create
:group
@group
.
add_owner
(
@user
)
@group
.
add_user
s
([
@user2
.
id
]
,
UsersGroup
::
OWNER
)
@group
.
add_user
(
@user2
,
UsersGroup
::
OWNER
)
end
it
{
@user2
.
several_namespaces?
.
should
be_true
}
...
...
spec/requests/api/groups_spec.rb
View file @
0a2a34a4
...
...
@@ -6,8 +6,13 @@ describe API::API do
let
(
:user1
)
{
create
(
:user
)
}
let
(
:user2
)
{
create
(
:user
)
}
let
(
:admin
)
{
create
(
:admin
)
}
let!
(
:group1
)
{
create
(
:group
,
owner:
user1
)
}
let!
(
:group2
)
{
create
(
:group
,
owner:
user2
)
}
let!
(
:group1
)
{
create
(
:group
)
}
let!
(
:group2
)
{
create
(
:group
)
}
before
do
group1
.
add_owner
(
user1
)
group2
.
add_owner
(
user2
)
end
describe
"GET /groups"
do
context
"when unauthenticated"
do
...
...
@@ -130,14 +135,19 @@ describe API::API do
let
(
:master
)
{
create
(
:user
)
}
let
(
:guest
)
{
create
(
:user
)
}
let!
(
:group_with_members
)
do
group
=
create
(
:group
,
owner:
owner
)
group
=
create
(
:group
)
group
.
add_users
([
reporter
.
id
],
UsersGroup
::
REPORTER
)
group
.
add_users
([
developer
.
id
],
UsersGroup
::
DEVELOPER
)
group
.
add_users
([
master
.
id
],
UsersGroup
::
MASTER
)
group
.
add_users
([
guest
.
id
],
UsersGroup
::
GUEST
)
group
end
let!
(
:group_no_members
)
{
create
(
:group
,
owner:
owner
)
}
let!
(
:group_no_members
)
{
create
(
:group
)
}
before
do
group_with_members
.
add_owner
owner
group_no_members
.
add_owner
owner
end
describe
"GET /groups/:id/members"
do
context
"when authenticated as user that is part or the group"
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