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
Boxiang Sun
gitlab-ce
Commits
503244eb
Commit
503244eb
authored
Mar 22, 2016
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix specs
parent
31266c5b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
11 deletions
+13
-11
db/migrate/20160301124843_add_visibility_level_to_groups.rb
db/migrate/20160301124843_add_visibility_level_to_groups.rb
+0
-1
db/migrate/20160308212903_add_default_group_visibility_to_application_settings.rb
...3_add_default_group_visibility_to_application_settings.rb
+2
-0
spec/finders/joined_groups_finder_spec.rb
spec/finders/joined_groups_finder_spec.rb
+11
-10
No files found.
db/migrate/20160301124843_add_visibility_level_to_groups.rb
View file @
503244eb
...
@@ -17,7 +17,6 @@ class AddVisibilityLevelToGroups < ActiveRecord::Migration
...
@@ -17,7 +17,6 @@ class AddVisibilityLevelToGroups < ActiveRecord::Migration
private
private
def
allowed_visibility_level
def
allowed_visibility_level
return
20
application_settings
=
select_one
(
"SELECT restricted_visibility_levels FROM application_settings ORDER BY id DESC LIMIT 1"
)
application_settings
=
select_one
(
"SELECT restricted_visibility_levels FROM application_settings ORDER BY id DESC LIMIT 1"
)
if
application_settings
if
application_settings
restricted_visibility_levels
=
YAML
.
safe_load
(
application_settings
[
"restricted_visibility_levels"
])
rescue
nil
restricted_visibility_levels
=
YAML
.
safe_load
(
application_settings
[
"restricted_visibility_levels"
])
rescue
nil
...
...
db/migrate/20160308212903_add_default_group_visibility_to_application_settings.rb
View file @
503244eb
...
@@ -5,6 +5,8 @@
...
@@ -5,6 +5,8 @@
class
AddDefaultGroupVisibilityToApplicationSettings
<
ActiveRecord
::
Migration
class
AddDefaultGroupVisibilityToApplicationSettings
<
ActiveRecord
::
Migration
def
up
def
up
add_column
:application_settings
,
:default_group_visibility
,
:integer
add_column
:application_settings
,
:default_group_visibility
,
:integer
# Unfortunately, this can't be a `default`, since we don't want the configuration specific
# `allowed_visibility_level` to end up in schema.rb
execute
(
"UPDATE application_settings SET default_group_visibility =
#{
allowed_visibility_level
}
"
)
execute
(
"UPDATE application_settings SET default_group_visibility =
#{
allowed_visibility_level
}
"
)
end
end
...
...
spec/finders/joined_groups_finder_spec.rb
View file @
503244eb
...
@@ -26,33 +26,34 @@ describe JoinedGroupsFinder do
...
@@ -26,33 +26,34 @@ describe JoinedGroupsFinder do
context
"with a user"
do
context
"with a user"
do
before
do
before
do
private_group
.
add_master
(
profile_owner
)
private_group
.
add_master
(
profile_owner
)
private_group
.
add_developer
(
profile_visitor
)
internal_group
.
add_master
(
profile_owner
)
internal_group
.
add_master
(
profile_owner
)
public_group
.
add_master
(
profile_owner
)
public_group
.
add_master
(
profile_owner
)
end
end
it
'only shows groups where both users are authorized to see'
do
context
"when the profile visitor is in the private group"
do
expect
(
finder
.
execute
(
profile_visitor
)).
to
eq
([
public_group
,
internal_group
,
private_group
])
before
do
private_group
.
add_developer
(
profile_visitor
)
end
it
'only shows groups where both users are authorized to see'
do
expect
(
finder
.
execute
(
profile_visitor
)).
to
eq
([
public_group
,
internal_group
,
private_group
])
end
end
end
context
'if profile visitor is in one of
its
projects'
do
context
'if profile visitor is in one of
the private group
projects'
do
before
do
before
do
public_group
.
add_master
(
profile_owner
)
private_group
.
add_master
(
profile_owner
)
project
=
create
(
:project
,
:private
,
group:
private_group
,
name:
'B'
,
path:
'B'
)
project
=
create
(
:project
,
:private
,
group:
private_group
,
name:
'B'
,
path:
'B'
)
project
.
team
.
add_
developer
(
profile_visitor
)
project
.
team
.
add_
user
(
profile_visitor
,
Gitlab
::
Access
::
DEVELOPER
)
end
end
it
'shows group'
do
it
'shows group'
do
expect
(
finder
.
execute
(
profile_visitor
)).
to
eq
([
public_group
,
private_group
])
expect
(
finder
.
execute
(
profile_visitor
)).
to
eq
([
public_group
,
internal_group
,
private_group
])
end
end
end
end
context
'external users'
do
context
'external users'
do
before
do
before
do
profile_visitor
.
update_attributes
(
external:
true
)
profile_visitor
.
update_attributes
(
external:
true
)
public_group
.
add_master
(
profile_owner
)
internal_group
.
add_master
(
profile_owner
)
end
end
context
'if not a member'
do
context
'if not a member'
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