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