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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
359ed486
Commit
359ed486
authored
Jun 22, 2015
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Style/AlignHash cop violations
parent
871bb2f1
Changes
15
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
178 additions
and
80 deletions
+178
-80
spec/controllers/blob_controller_spec.rb
spec/controllers/blob_controller_spec.rb
+8
-4
spec/controllers/commit_controller_spec.rb
spec/controllers/commit_controller_spec.rb
+36
-16
spec/controllers/commits_controller_spec.rb
spec/controllers/commits_controller_spec.rb
+5
-2
spec/controllers/help_controller_spec.rb
spec/controllers/help_controller_spec.rb
+12
-4
spec/controllers/projects/compare_controller_spec.rb
spec/controllers/projects/compare_controller_spec.rb
+5
-2
spec/controllers/projects/merge_requests_controller_spec.rb
spec/controllers/projects/merge_requests_controller_spec.rb
+44
-18
spec/controllers/projects/refs_controller_spec.rb
spec/controllers/projects/refs_controller_spec.rb
+11
-6
spec/controllers/projects_controller_spec.rb
spec/controllers/projects_controller_spec.rb
+10
-6
spec/controllers/tree_controller_spec.rb
spec/controllers/tree_controller_spec.rb
+8
-4
spec/features/atom/users_spec.rb
spec/features/atom/users_spec.rb
+13
-6
spec/lib/gitlab/asciidoc_spec.rb
spec/lib/gitlab/asciidoc_spec.rb
+10
-4
spec/lib/votes_spec.rb
spec/lib/votes_spec.rb
+5
-2
spec/requests/api/project_members_spec.rb
spec/requests/api/project_members_spec.rb
+3
-2
spec/services/merge_requests/refresh_service_spec.rb
spec/services/merge_requests/refresh_service_spec.rb
+4
-2
spec/services/projects/fork_service_spec.rb
spec/services/projects/fork_service_spec.rb
+4
-2
No files found.
spec/controllers/blob_controller_spec.rb
View file @
359ed486
...
...
@@ -18,8 +18,10 @@ describe Projects::BlobController do
render_views
before
do
get
(
:show
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
.
to_param
,
id:
id
)
get
(
:show
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
.
to_param
,
id:
id
)
end
context
"valid branch, valid file"
do
...
...
@@ -42,8 +44,10 @@ describe Projects::BlobController do
render_views
before
do
get
(
:show
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
.
to_param
,
id:
id
)
get
(
:show
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
.
to_param
,
id:
id
)
controller
.
instance_variable_set
(
:@blob
,
nil
)
end
...
...
spec/controllers/commit_controller_spec.rb
View file @
359ed486
...
...
@@ -13,8 +13,11 @@ describe Projects::CommitController do
describe
"#show"
do
shared_examples
"export as"
do
|
format
|
it
"should generally work"
do
get
(
:show
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
.
to_param
,
id:
commit
.
id
,
format:
format
)
get
(
:show
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
.
to_param
,
id:
commit
.
id
,
format:
format
)
expect
(
response
).
to
be_success
end
...
...
@@ -22,13 +25,17 @@ describe Projects::CommitController do
it
"should generate it"
do
expect_any_instance_of
(
Commit
).
to
receive
(
:"to_
#{
format
}
"
)
get
(
:show
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
.
to_param
,
id:
commit
.
id
,
format:
format
)
get
(
:show
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
.
to_param
,
id:
commit
.
id
,
format:
format
)
end
it
"should render it"
do
get
(
:show
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
.
to_param
,
id:
commit
.
id
,
format:
format
)
get
(
:show
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
.
to_param
,
id:
commit
.
id
,
format:
format
)
expect
(
response
.
body
).
to
eq
(
commit
.
send
(
:"to_
#{
format
}
"
))
end
...
...
@@ -37,8 +44,10 @@ describe Projects::CommitController do
allow_any_instance_of
(
Commit
).
to
receive
(
:"to_
#{
format
}
"
).
and_return
(
'HTML entities &<>" '
)
get
(
:show
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
.
to_param
,
id:
commit
.
id
,
format:
format
)
get
(
:show
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
.
to_param
,
id:
commit
.
id
,
format:
format
)
expect
(
response
.
body
).
to_not
include
(
'&'
)
expect
(
response
.
body
).
to_not
include
(
'>'
)
...
...
@@ -52,8 +61,11 @@ describe Projects::CommitController do
let
(
:format
)
{
:diff
}
it
"should really only be a git diff"
do
get
(
:show
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
.
to_param
,
id:
commit
.
id
,
format:
format
)
get
(
:show
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
.
to_param
,
id:
commit
.
id
,
format:
format
)
expect
(
response
.
body
).
to
start_with
(
"diff --git"
)
end
...
...
@@ -64,15 +76,21 @@ describe Projects::CommitController do
let
(
:format
)
{
:patch
}
it
"should really be a git email patch"
do
get
(
:show
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
.
to_param
,
id:
commit
.
id
,
format:
format
)
get
(
:show
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
.
to_param
,
id:
commit
.
id
,
format:
format
)
expect
(
response
.
body
).
to
start_with
(
"From
#{
commit
.
id
}
"
)
end
it
"should contain a git diff"
do
get
(
:show
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
.
to_param
,
id:
commit
.
id
,
format:
format
)
get
(
:show
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
.
to_param
,
id:
commit
.
id
,
format:
format
)
expect
(
response
.
body
).
to
match
(
/^diff --git/
)
end
...
...
@@ -81,8 +99,10 @@ describe Projects::CommitController do
describe
"#branches"
do
it
"contains branch and tags information"
do
get
(
:branches
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
.
to_param
,
id:
commit
.
id
)
get
(
:branches
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
.
to_param
,
id:
commit
.
id
)
expect
(
assigns
(
:branches
)).
to
include
(
"master"
,
"feature_conflict"
)
expect
(
assigns
(
:tags
)).
to
include
(
"v1.1.0"
)
...
...
spec/controllers/commits_controller_spec.rb
View file @
359ed486
...
...
@@ -12,8 +12,11 @@ describe Projects::CommitsController do
describe
"GET show"
do
context
"as atom feed"
do
it
"should render as atom"
do
get
(
:show
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
.
to_param
,
id:
"master"
,
format:
"atom"
)
get
(
:show
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
.
to_param
,
id:
"master"
,
format:
"atom"
)
expect
(
response
).
to
be_success
expect
(
response
.
content_type
).
to
eq
(
'application/atom+xml'
)
end
...
...
spec/controllers/help_controller_spec.rb
View file @
359ed486
...
...
@@ -35,8 +35,10 @@ describe HelpController do
context
'for image formats'
do
context
'when requested file exists'
do
it
'renders the raw file'
do
get
:show
,
category:
'workflow/protected_branches'
,
file:
'protected_branches1'
,
format: :png
get
:show
,
category:
'workflow/protected_branches'
,
file:
'protected_branches1'
,
format: :png
expect
(
response
).
to
be_success
expect
(
response
.
content_type
).
to
eq
'image/png'
expect
(
response
.
headers
[
'Content-Disposition'
]).
to
match
(
/^inline;/
)
...
...
@@ -45,7 +47,10 @@ describe HelpController do
context
'when requested file is missing'
do
it
'renders not found'
do
get
:show
,
category:
'foo'
,
file:
'bar'
,
format: :png
get
:show
,
category:
'foo'
,
file:
'bar'
,
format: :png
expect
(
response
).
to
be_not_found
end
end
...
...
@@ -53,7 +58,10 @@ describe HelpController do
context
'for other formats'
do
it
'always renders not found'
do
get
:show
,
category:
'ssh'
,
file:
'README'
,
format: :foo
get
:show
,
category:
'ssh'
,
file:
'README'
,
format: :foo
expect
(
response
).
to
be_not_found
end
end
...
...
spec/controllers/projects/compare_controller_spec.rb
View file @
359ed486
...
...
@@ -12,8 +12,11 @@ describe Projects::CompareController do
end
it
'compare should show some diffs'
do
get
(
:show
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
.
to_param
,
from:
ref_from
,
to:
ref_to
)
get
(
:show
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
.
to_param
,
from:
ref_from
,
to:
ref_to
)
expect
(
response
).
to
be_success
expect
(
assigns
(
:diffs
).
length
).
to
be
>=
1
...
...
spec/controllers/projects/merge_requests_controller_spec.rb
View file @
359ed486
...
...
@@ -13,8 +13,11 @@ describe Projects::MergeRequestsController do
describe
"#show"
do
shared_examples
"export merge as"
do
|
format
|
it
"should generally work"
do
get
(
:show
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
.
to_param
,
id:
merge_request
.
iid
,
format:
format
)
get
(
:show
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
.
to_param
,
id:
merge_request
.
iid
,
format:
format
)
expect
(
response
).
to
be_success
end
...
...
@@ -22,13 +25,19 @@ describe Projects::MergeRequestsController do
it
"should generate it"
do
expect_any_instance_of
(
MergeRequest
).
to
receive
(
:"to_
#{
format
}
"
)
get
(
:show
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
.
to_param
,
id:
merge_request
.
iid
,
format:
format
)
get
(
:show
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
.
to_param
,
id:
merge_request
.
iid
,
format:
format
)
end
it
"should render it"
do
get
(
:show
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
.
to_param
,
id:
merge_request
.
iid
,
format:
format
)
get
(
:show
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
.
to_param
,
id:
merge_request
.
iid
,
format:
format
)
expect
(
response
.
body
).
to
eq
((
merge_request
.
send
(
:"to_
#{
format
}
"
,
user
)).
to_s
)
end
...
...
@@ -37,8 +46,11 @@ describe Projects::MergeRequestsController do
allow_any_instance_of
(
MergeRequest
).
to
receive
(
:"to_
#{
format
}
"
).
and_return
(
'HTML entities &<>" '
)
get
(
:show
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
.
to_param
,
id:
merge_request
.
iid
,
format:
format
)
get
(
:show
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
.
to_param
,
id:
merge_request
.
iid
,
format:
format
)
expect
(
response
.
body
).
to_not
include
(
'&'
)
expect
(
response
.
body
).
to_not
include
(
'>'
)
...
...
@@ -52,8 +64,11 @@ describe Projects::MergeRequestsController do
let
(
:format
)
{
:diff
}
it
"should really only be a git diff"
do
get
(
:show
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
.
to_param
,
id:
merge_request
.
iid
,
format:
format
)
get
(
:show
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
.
to_param
,
id:
merge_request
.
iid
,
format:
format
)
expect
(
response
.
body
).
to
start_with
(
"diff --git"
)
end
...
...
@@ -64,15 +79,20 @@ describe Projects::MergeRequestsController do
let
(
:format
)
{
:patch
}
it
"should really be a git email patch with commit"
do
get
(
:show
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
.
to_param
,
id:
merge_request
.
iid
,
format:
format
)
get
(
:show
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
.
to_param
,
id:
merge_request
.
iid
,
format:
format
)
expect
(
response
.
body
[
0
..
100
]).
to
start_with
(
"From
#{
merge_request
.
commits
.
last
.
id
}
"
)
end
it
"should contain git diffs"
do
get
(
:show
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
.
to_param
,
id:
merge_request
.
iid
,
format:
format
)
get
(
:show
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
.
to_param
,
id:
merge_request
.
iid
,
format:
format
)
expect
(
response
.
body
).
to
match
(
/^diff --git/
)
end
...
...
@@ -81,8 +101,11 @@ describe Projects::MergeRequestsController do
describe
'GET diffs'
do
def
go
(
format:
'html'
)
get
:diffs
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
.
to_param
,
id:
merge_request
.
iid
,
format:
format
get
:diffs
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
.
to_param
,
id:
merge_request
.
iid
,
format:
format
end
context
'as html'
do
...
...
@@ -126,8 +149,11 @@ describe Projects::MergeRequestsController do
describe
'GET commits'
do
def
go
(
format:
'html'
)
get
:commits
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
.
to_param
,
id:
merge_request
.
iid
,
format:
format
get
:commits
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
.
to_param
,
id:
merge_request
.
iid
,
format:
format
end
context
'as html'
do
...
...
spec/controllers/projects/refs_controller_spec.rb
View file @
359ed486
...
...
@@ -11,13 +11,18 @@ describe Projects::RefsController do
describe
'GET #logs_tree'
do
def
default_get
(
format
=
:html
)
get
:logs_tree
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
.
to_param
,
id:
'master'
,
path:
'foo/bar/baz.html'
,
format:
format
get
:logs_tree
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
.
to_param
,
id:
'master'
,
path:
'foo/bar/baz.html'
,
format:
format
end
def
xhr_get
(
format
=
:html
)
xhr
:get
,
:logs_tree
,
namespace_id:
project
.
namespace
.
to_param
,
xhr
:get
,
:logs_tree
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
.
to_param
,
id:
'master'
,
path:
'foo/bar/baz.html'
,
format:
format
end
...
...
spec/controllers/projects_controller_spec.rb
View file @
359ed486
...
...
@@ -27,19 +27,23 @@ describe ProjectsController do
it
"toggles star if user is signed in"
do
sign_in
(
user
)
expect
(
user
.
starred?
(
public_project
)).
to
be_falsey
post
(
:toggle_star
,
namespace_id:
public_project
.
namespace
.
to_param
,
post
(
:toggle_star
,
namespace_id:
public_project
.
namespace
.
to_param
,
id:
public_project
.
to_param
)
expect
(
user
.
starred?
(
public_project
)).
to
be_truthy
post
(
:toggle_star
,
namespace_id:
public_project
.
namespace
.
to_param
,
post
(
:toggle_star
,
namespace_id:
public_project
.
namespace
.
to_param
,
id:
public_project
.
to_param
)
expect
(
user
.
starred?
(
public_project
)).
to
be_falsey
end
it
"does nothing if user is not signed in"
do
post
(
:toggle_star
,
namespace_id:
project
.
namespace
.
to_param
,
post
(
:toggle_star
,
namespace_id:
project
.
namespace
.
to_param
,
id:
public_project
.
to_param
)
expect
(
user
.
starred?
(
public_project
)).
to
be_falsey
post
(
:toggle_star
,
namespace_id:
project
.
namespace
.
to_param
,
post
(
:toggle_star
,
namespace_id:
project
.
namespace
.
to_param
,
id:
public_project
.
to_param
)
expect
(
user
.
starred?
(
public_project
)).
to
be_falsey
end
...
...
spec/controllers/tree_controller_spec.rb
View file @
359ed486
...
...
@@ -19,8 +19,10 @@ describe Projects::TreeController do
render_views
before
do
get
(
:show
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
.
to_param
,
id:
id
)
get
(
:show
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
.
to_param
,
id:
id
)
end
context
"valid branch, no path"
do
...
...
@@ -48,8 +50,10 @@ describe Projects::TreeController do
render_views
before
do
get
(
:show
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
.
to_param
,
id:
id
)
get
(
:show
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
.
to_param
,
id:
id
)
end
context
'redirect to blob'
do
...
...
spec/features/atom/users_spec.rb
View file @
359ed486
...
...
@@ -14,17 +14,24 @@ describe "User Feed", feature: true do
context
'feed content'
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:issue
)
do
create
(
:issue
,
project:
project
,
author:
user
,
description:
"Houston, we have a bug!
\n\n
***
\n\n
I guess."
)
create
(
:issue
,
project:
project
,
author:
user
,
description:
"Houston, we have a bug!
\n\n
***
\n\n
I guess."
)
end
let
(
:note
)
do
create
(
:note
,
noteable:
issue
,
author:
user
,
note:
'Bug confirmed :+1:'
,
project:
project
)
create
(
:note
,
noteable:
issue
,
author:
user
,
note:
'Bug confirmed :+1:'
,
project:
project
)
end
let
(
:merge_request
)
do
create
(
:merge_request
,
title:
'Fix bug'
,
author:
user
,
source_project:
project
,
target_project:
project
,
title:
'Fix bug'
,
author:
user
,
source_project:
project
,
target_project:
project
,
description:
"Here is the fix: ![an image](image.png)"
)
end
...
...
spec/lib/gitlab/asciidoc_spec.rb
View file @
359ed486
...
...
@@ -11,8 +11,11 @@ module Gitlab
context
"without project"
do
it
"should convert the input using Asciidoctor and default options"
do
expected_asciidoc_opts
=
{
safe: :secure
,
backend: :html5
,
attributes:
described_class
::
DEFAULT_ADOC_ATTRS
}
expected_asciidoc_opts
=
{
safe: :secure
,
backend: :html5
,
attributes:
described_class
::
DEFAULT_ADOC_ATTRS
}
expect
(
Asciidoctor
).
to
receive
(
:convert
)
.
with
(
input
,
expected_asciidoc_opts
).
and_return
(
html
)
...
...
@@ -25,8 +28,11 @@ module Gitlab
let
(
:asciidoc_opts
)
{
{
safe: :safe
,
attributes:
[
'foo'
]
}
}
it
"should merge the options with default ones"
do
expected_asciidoc_opts
=
{
safe: :safe
,
backend: :html5
,
attributes:
described_class
::
DEFAULT_ADOC_ATTRS
+
[
'foo'
]
}
expected_asciidoc_opts
=
{
safe: :safe
,
backend: :html5
,
attributes:
described_class
::
DEFAULT_ADOC_ATTRS
+
[
'foo'
]
}
expect
(
Asciidoctor
).
to
receive
(
:convert
)
.
with
(
input
,
expected_asciidoc_opts
).
and_return
(
html
)
...
...
spec/lib/votes_spec.rb
View file @
359ed486
...
...
@@ -179,7 +179,10 @@ describe Issue, 'Votes' do
def
add_note
(
text
,
author
=
issue
.
author
)
created_at
=
Time
.
now
-
1
.
hour
+
Note
.
count
.
seconds
issue
.
notes
<<
create
(
:note
,
note:
text
,
project:
issue
.
project
,
author_id:
author
.
id
,
created_at:
created_at
)
issue
.
notes
<<
create
(
:note
,
note:
text
,
project:
issue
.
project
,
author_id:
author
.
id
,
created_at:
created_at
)
end
end
spec/requests/api/project_members_spec.rb
View file @
359ed486
...
...
@@ -63,7 +63,8 @@ describe API::API, api: true do
end
it
"should return a 201 status if user is already project member"
do
post
api
(
"/projects/
#{
project
.
id
}
/members"
,
user
),
user_id:
user2
.
id
,
post
api
(
"/projects/
#{
project
.
id
}
/members"
,
user
),
user_id:
user2
.
id
,
access_level:
ProjectMember
::
DEVELOPER
expect
do
post
api
(
"/projects/
#{
project
.
id
}
/members"
,
user
),
user_id:
user2
.
id
,
access_level:
ProjectMember
::
DEVELOPER
...
...
spec/services/merge_requests/refresh_service_spec.rb
View file @
359ed486
...
...
@@ -13,12 +13,14 @@ describe MergeRequests::RefreshService do
@project
=
create
(
:project
,
namespace:
group
)
@fork_project
=
Projects
::
ForkService
.
new
(
@project
,
@user
).
execute
@merge_request
=
create
(
:merge_request
,
source_project:
@project
,
@merge_request
=
create
(
:merge_request
,
source_project:
@project
,
source_branch:
'master'
,
target_branch:
'feature'
,
target_project:
@project
)
@fork_merge_request
=
create
(
:merge_request
,
source_project:
@fork_project
,
@fork_merge_request
=
create
(
:merge_request
,
source_project:
@fork_project
,
source_branch:
'master'
,
target_branch:
'feature'
,
target_project:
@project
)
...
...
spec/services/projects/fork_service_spec.rb
View file @
359ed486
...
...
@@ -5,8 +5,10 @@ describe Projects::ForkService do
before
do
@from_namespace
=
create
(
:namespace
)
@from_user
=
create
(
:user
,
namespace:
@from_namespace
)
@from_project
=
create
(
:project
,
creator_id:
@from_user
.
id
,
namespace:
@from_namespace
,
star_count:
107
,
@from_project
=
create
(
:project
,
creator_id:
@from_user
.
id
,
namespace:
@from_namespace
,
star_count:
107
,
description:
'wow such project'
)
@to_namespace
=
create
(
:namespace
)
@to_user
=
create
(
:user
,
namespace:
@to_namespace
)
...
...
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