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
Tatuya Kamada
gitlab-ce
Commits
19aa20d5
Commit
19aa20d5
authored
Mar 20, 2016
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix more specs
parent
7c51d5ef
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
33 additions
and
35 deletions
+33
-35
app/views/admin/projects/show.html.haml
app/views/admin/projects/show.html.haml
+1
-1
db/schema.rb
db/schema.rb
+1
-1
spec/controllers/groups/avatars_controller_spec.rb
spec/controllers/groups/avatars_controller_spec.rb
+2
-1
spec/controllers/namespaces_controller_spec.rb
spec/controllers/namespaces_controller_spec.rb
+6
-6
spec/controllers/uploads_controller_spec.rb
spec/controllers/uploads_controller_spec.rb
+5
-5
spec/models/group_spec.rb
spec/models/group_spec.rb
+2
-3
spec/services/create_snippet_service_spec.rb
spec/services/create_snippet_service_spec.rb
+1
-1
spec/services/groups/update_service_spec.rb
spec/services/groups/update_service_spec.rb
+14
-16
spec/services/update_snippet_service_spec.rb
spec/services/update_snippet_service_spec.rb
+1
-1
No files found.
app/views/admin/projects/show.html.haml
View file @
19aa20d5
...
@@ -52,7 +52,7 @@
...
@@ -52,7 +52,7 @@
%li
%li
%span
.light
fs:
%span
.light
fs:
%strong
%strong
=
@repository
.
path_to_repo
=
@
project
.
repository
.
path_to_repo
%li
%li
%span
.light
Size
%span
.light
Size
...
...
db/schema.rb
View file @
19aa20d5
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
#
#
# It's strongly recommended that you check this file into your version control system.
# It's strongly recommended that you check this file into your version control system.
ActiveRecord
::
Schema
.
define
(
version:
201603
16204731
)
do
ActiveRecord
::
Schema
.
define
(
version:
201603
20204112
)
do
# These are extensions that must be enabled in order to support this database
# These are extensions that must be enabled in order to support this database
enable_extension
"plpgsql"
enable_extension
"plpgsql"
...
...
spec/controllers/groups/avatars_controller_spec.rb
View file @
19aa20d5
...
@@ -2,9 +2,10 @@ require 'spec_helper'
...
@@ -2,9 +2,10 @@ require 'spec_helper'
describe
Groups
::
AvatarsController
do
describe
Groups
::
AvatarsController
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:group
)
{
create
(
:group
,
owner:
user
,
avatar:
fixture_file_upload
(
Rails
.
root
+
"spec/fixtures/dk.png"
,
"image/png"
))
}
let
(
:group
)
{
create
(
:group
,
avatar:
fixture_file_upload
(
Rails
.
root
+
"spec/fixtures/dk.png"
,
"image/png"
))
}
before
do
before
do
group
.
add_owner
(
user
)
sign_in
(
user
)
sign_in
(
user
)
end
end
...
...
spec/controllers/namespaces_controller_spec.rb
View file @
19aa20d5
...
@@ -18,10 +18,6 @@ describe NamespacesController do
...
@@ -18,10 +18,6 @@ describe NamespacesController do
let!
(
:group
)
{
create
(
:group
)
}
let!
(
:group
)
{
create
(
:group
)
}
context
"when the group is public"
do
context
"when the group is public"
do
before
do
group
.
update_attribute
(
:visibility_level
,
Group
::
PUBLIC
)
end
context
"when not signed in"
do
context
"when not signed in"
do
it
"redirects to the group's page"
do
it
"redirects to the group's page"
do
get
:show
,
id:
group
.
path
get
:show
,
id:
group
.
path
...
@@ -44,10 +40,14 @@ describe NamespacesController do
...
@@ -44,10 +40,14 @@ describe NamespacesController do
end
end
context
"when the group is private"
do
context
"when the group is private"
do
before
do
group
.
update_attribute
(
:visibility_level
,
Group
::
PRIVATE
)
end
context
"when not signed in"
do
context
"when not signed in"
do
it
"
does not redirect
to the sign in page"
do
it
"
redirects
to the sign in page"
do
get
:show
,
id:
group
.
path
get
:show
,
id:
group
.
path
expect
(
response
).
not_
to
redirect_to
(
new_user_session_path
)
expect
(
response
).
to
redirect_to
(
new_user_session_path
)
end
end
end
end
...
...
spec/controllers/uploads_controller_spec.rb
View file @
19aa20d5
...
@@ -129,10 +129,6 @@ describe UploadsController do
...
@@ -129,10 +129,6 @@ describe UploadsController do
let!
(
:group
)
{
create
(
:group
,
avatar:
fixture_file_upload
(
Rails
.
root
+
"spec/fixtures/dk.png"
,
"image/png"
))
}
let!
(
:group
)
{
create
(
:group
,
avatar:
fixture_file_upload
(
Rails
.
root
+
"spec/fixtures/dk.png"
,
"image/png"
))
}
context
"when the group is public"
do
context
"when the group is public"
do
before
do
group
.
update_attribute
(
:visibility_level
,
Gitlab
::
VisibilityLevel
::
PUBLIC
)
end
context
"when not signed in"
do
context
"when not signed in"
do
it
"responds with status 200"
do
it
"responds with status 200"
do
get
:show
,
model:
"group"
,
mounted_as:
"avatar"
,
id:
group
.
id
,
filename:
"image.png"
get
:show
,
model:
"group"
,
mounted_as:
"avatar"
,
id:
group
.
id
,
filename:
"image.png"
...
@@ -155,6 +151,10 @@ describe UploadsController do
...
@@ -155,6 +151,10 @@ describe UploadsController do
end
end
context
"when the group is private"
do
context
"when the group is private"
do
before
do
group
.
update_attribute
(
:visibility_level
,
Gitlab
::
VisibilityLevel
::
PRIVATE
)
end
context
"when signed in"
do
context
"when signed in"
do
before
do
before
do
sign_in
(
user
)
sign_in
(
user
)
...
@@ -162,7 +162,7 @@ describe UploadsController do
...
@@ -162,7 +162,7 @@ describe UploadsController do
context
"when the user has access to the project"
do
context
"when the user has access to the project"
do
before
do
before
do
project
.
add_developer
(
user
)
group
.
add_developer
(
user
)
end
end
context
"when the user is blocked"
do
context
"when the user is blocked"
do
...
...
spec/models/group_spec.rb
View file @
19aa20d5
...
@@ -59,18 +59,17 @@ describe Group, models: true do
...
@@ -59,18 +59,17 @@ describe Group, models: true do
describe
'scopes'
do
describe
'scopes'
do
let!
(
:private_group
)
{
create
(
:group
,
:private
)
}
let!
(
:private_group
)
{
create
(
:group
,
:private
)
}
let!
(
:internal_group
)
{
create
(
:group
,
:internal
)
}
let!
(
:internal_group
)
{
create
(
:group
,
:internal
)
}
let!
(
:public_group
)
{
create
(
:group
,
:public
)
}
describe
'public_only'
do
describe
'public_only'
do
subject
{
described_class
.
public_only
.
to_a
}
subject
{
described_class
.
public_only
.
to_a
}
it
{
is_expected
.
to
eq
([
public_
group
])
}
it
{
is_expected
.
to
eq
([
group
])
}
end
end
describe
'public_and_internal_only'
do
describe
'public_and_internal_only'
do
subject
{
described_class
.
public_and_internal_only
.
to_a
}
subject
{
described_class
.
public_and_internal_only
.
to_a
}
it
{
is_expected
.
to
eq
([
public_
group
,
internal_group
])
}
it
{
is_expected
.
to
eq
([
group
,
internal_group
])
}
end
end
end
end
...
...
spec/services/create_snippet_service_spec.rb
View file @
19aa20d5
...
@@ -23,7 +23,7 @@ describe CreateSnippetService, services: true do
...
@@ -23,7 +23,7 @@ describe CreateSnippetService, services: true do
snippet
=
create_snippet
(
nil
,
@user
,
@opts
)
snippet
=
create_snippet
(
nil
,
@user
,
@opts
)
expect
(
snippet
.
errors
.
messages
).
to
have_key
(
:visibility_level
)
expect
(
snippet
.
errors
.
messages
).
to
have_key
(
:visibility_level
)
expect
(
snippet
.
errors
.
messages
[
:visibility_level
].
first
).
to
(
expect
(
snippet
.
errors
.
messages
[
:visibility_level
].
first
).
to
(
match
(
'
Public visibility
has been restricted'
)
match
(
'has been restricted'
)
)
)
end
end
...
...
spec/services/groups/update_service_spec.rb
View file @
19aa20d5
...
@@ -6,9 +6,8 @@ describe Groups::UpdateService, services: true do
...
@@ -6,9 +6,8 @@ describe Groups::UpdateService, services: true do
let!
(
:internal_group
)
{
create
(
:group
,
:internal
)
}
let!
(
:internal_group
)
{
create
(
:group
,
:internal
)
}
let!
(
:public_group
)
{
create
(
:group
,
:public
)
}
let!
(
:public_group
)
{
create
(
:group
,
:public
)
}
describe
"execute"
do
describe
"
#
execute"
do
context
"project visibility_level validation"
do
context
"project visibility_level validation"
do
context
"public group with public projects"
do
context
"public group with public projects"
do
let!
(
:service
)
{
described_class
.
new
(
public_group
,
user
,
visibility_level:
Gitlab
::
VisibilityLevel
::
INTERNAL
)
}
let!
(
:service
)
{
described_class
.
new
(
public_group
,
user
,
visibility_level:
Gitlab
::
VisibilityLevel
::
INTERNAL
)
}
...
@@ -18,7 +17,6 @@ describe Groups::UpdateService, services: true do
...
@@ -18,7 +17,6 @@ describe Groups::UpdateService, services: true do
end
end
it
"cant downgrade permission level"
do
it
"cant downgrade permission level"
do
expect
(
service
.
execute
).
to
be_falsy
expect
(
public_group
.
errors
.
count
).
to
eq
(
2
)
expect
(
public_group
.
errors
.
count
).
to
eq
(
2
)
end
end
end
end
...
@@ -32,7 +30,6 @@ describe Groups::UpdateService, services: true do
...
@@ -32,7 +30,6 @@ describe Groups::UpdateService, services: true do
end
end
it
"cant downgrade permission level"
do
it
"cant downgrade permission level"
do
expect
(
service
.
execute
).
to
be_falsy
expect
(
internal_group
.
errors
.
count
).
to
eq
(
2
)
expect
(
internal_group
.
errors
.
count
).
to
eq
(
2
)
end
end
end
end
...
@@ -41,10 +38,11 @@ describe Groups::UpdateService, services: true do
...
@@ -41,10 +38,11 @@ describe Groups::UpdateService, services: true do
context
"unauthorized visibility_level validation"
do
context
"unauthorized visibility_level validation"
do
let!
(
:service
)
{
described_class
.
new
(
internal_group
,
user
,
visibility_level:
99
)
}
let!
(
:service
)
{
described_class
.
new
(
internal_group
,
user
,
visibility_level:
99
)
}
before
{
internal_group
.
add_user
(
user
,
Gitlab
::
Access
::
MASTER
)
}
before
do
internal_group
.
add_user
(
user
,
Gitlab
::
Access
::
MASTER
)
end
it
"does not change permission level"
do
it
"does not change permission level"
do
expect
(
service
.
execute
).
to
be_falsy
expect
(
internal_group
.
errors
.
count
).
to
eq
(
1
)
expect
(
internal_group
.
errors
.
count
).
to
eq
(
1
)
end
end
end
end
...
...
spec/services/update_snippet_service_spec.rb
View file @
19aa20d5
...
@@ -25,7 +25,7 @@ describe UpdateSnippetService, services: true do
...
@@ -25,7 +25,7 @@ describe UpdateSnippetService, services: true do
update_snippet
(
@project
,
@user
,
@snippet
,
@opts
)
update_snippet
(
@project
,
@user
,
@snippet
,
@opts
)
expect
(
@snippet
.
errors
.
messages
).
to
have_key
(
:visibility_level
)
expect
(
@snippet
.
errors
.
messages
).
to
have_key
(
:visibility_level
)
expect
(
@snippet
.
errors
.
messages
[
:visibility_level
].
first
).
to
(
expect
(
@snippet
.
errors
.
messages
[
:visibility_level
].
first
).
to
(
match
(
'
Public visibility
has been restricted'
)
match
(
'has been restricted'
)
)
)
expect
(
@snippet
.
visibility_level
).
to
eq
(
old_visibility
)
expect
(
@snippet
.
visibility_level
).
to
eq
(
old_visibility
)
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