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
940a402b
Commit
940a402b
authored
Feb 12, 2015
by
Jeroen van Baarsen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed hound warnings
Signed-off-by:
Jeroen van Baarsen
<
jeroenvanbaarsen@gmail.com
>
parent
0c4a70a3
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
31 additions
and
15 deletions
+31
-15
spec/controllers/blob_controller_spec.rb
spec/controllers/blob_controller_spec.rb
+4
-1
spec/controllers/branches_controller_spec.rb
spec/controllers/branches_controller_spec.rb
+10
-4
spec/controllers/commit_controller_spec.rb
spec/controllers/commit_controller_spec.rb
+2
-1
spec/controllers/import/github_controller_spec.rb
spec/controllers/import/github_controller_spec.rb
+8
-4
spec/controllers/import/gitlab_controller_spec.rb
spec/controllers/import/gitlab_controller_spec.rb
+5
-4
spec/controllers/merge_requests_controller_spec.rb
spec/controllers/merge_requests_controller_spec.rb
+2
-1
No files found.
spec/controllers/blob_controller_spec.rb
View file @
940a402b
...
@@ -45,7 +45,10 @@ describe Projects::BlobController do
...
@@ -45,7 +45,10 @@ describe Projects::BlobController do
context
'redirect to tree'
do
context
'redirect to tree'
do
let
(
:id
)
{
'markdown/doc'
}
let
(
:id
)
{
'markdown/doc'
}
it
{
is_expected
.
to
redirect_to
(
"/
#{
project
.
path_with_namespace
}
/tree/markdown/doc"
)
}
it
"redirects"
do
expect
(
subject
).
to
redirect_to
(
"/
#{
project
.
path_with_namespace
}
/tree/markdown/doc"
)
end
end
end
end
end
end
end
spec/controllers/branches_controller_spec.rb
View file @
940a402b
...
@@ -27,25 +27,31 @@ describe Projects::BranchesController do
...
@@ -27,25 +27,31 @@ describe Projects::BranchesController do
context
"valid branch name, valid source"
do
context
"valid branch name, valid source"
do
let
(
:branch
)
{
"merge_branch"
}
let
(
:branch
)
{
"merge_branch"
}
let
(
:ref
)
{
"master"
}
let
(
:ref
)
{
"master"
}
it
{
is_expected
.
to
redirect_to
(
"/
#{
project
.
path_with_namespace
}
/tree/merge_branch"
)
}
it
'redirects'
do
expect
(
subject
).
to
redirect_to
(
"/
#{
project
.
path_with_namespace
}
/tree/merge_branch"
)
end
end
end
context
"invalid branch name, valid ref"
do
context
"invalid branch name, valid ref"
do
let
(
:branch
)
{
"<script>alert('merge');</script>"
}
let
(
:branch
)
{
"<script>alert('merge');</script>"
}
let
(
:ref
)
{
"master"
}
let
(
:ref
)
{
"master"
}
it
{
is_expected
.
to
redirect_to
(
"/
#{
project
.
path_with_namespace
}
/tree/alert('merge');"
)
}
it
'redirects'
do
expect
(
subject
).
to
redirect_to
(
"/
#{
project
.
path_with_namespace
}
/tree/alert('merge');"
)
end
end
end
context
"valid branch name, invalid ref"
do
context
"valid branch name, invalid ref"
do
let
(
:branch
)
{
"merge_branch"
}
let
(
:branch
)
{
"merge_branch"
}
let
(
:ref
)
{
"<script>alert('ref');</script>"
}
let
(
:ref
)
{
"<script>alert('ref');</script>"
}
it
{
is_expected
.
to
render_template
(
"new"
)
}
it
{
is_expected
.
to
render_template
(
'new'
)
}
end
end
context
"invalid branch name, invalid ref"
do
context
"invalid branch name, invalid ref"
do
let
(
:branch
)
{
"<script>alert('merge');</script>"
}
let
(
:branch
)
{
"<script>alert('merge');</script>"
}
let
(
:ref
)
{
"<script>alert('ref');</script>"
}
let
(
:ref
)
{
"<script>alert('ref');</script>"
}
it
{
is_expected
.
to
render_template
(
"new"
)
}
it
{
is_expected
.
to
render_template
(
'new'
)
}
end
end
end
end
end
end
spec/controllers/commit_controller_spec.rb
View file @
940a402b
...
@@ -31,7 +31,8 @@ describe Projects::CommitController do
...
@@ -31,7 +31,8 @@ describe Projects::CommitController do
end
end
it
"should not escape Html"
do
it
"should not escape Html"
do
allow_any_instance_of
(
Commit
).
to
receive
(
:"to_
#{
format
}
"
).
and_return
(
'HTML entities &<>" '
)
allow_any_instance_of
(
Commit
).
to
receive
(
:"to_
#{
format
}
"
)
.
and_return
(
'HTML entities &<>" '
)
get
:show
,
project_id:
project
.
to_param
,
id:
commit
.
id
,
format:
format
get
:show
,
project_id:
project
.
to_param
,
id:
commit
.
id
,
format:
format
...
...
spec/controllers/import/github_controller_spec.rb
View file @
940a402b
...
@@ -10,11 +10,14 @@ describe Import::GithubController do
...
@@ -10,11 +10,14 @@ describe Import::GithubController do
describe
"GET callback"
do
describe
"GET callback"
do
it
"updates access token"
do
it
"updates access token"
do
token
=
"asdasd12345"
token
=
"asdasd12345"
allow_any_instance_of
(
Gitlab
::
GithubImport
::
Client
).
to
receive
(
:get_token
).
and_return
(
token
)
allow_any_instance_of
(
Gitlab
::
GithubImport
::
Client
).
Gitlab
.
config
.
omniauth
.
providers
<<
OpenStruct
.
new
(
app_id:
"asd123"
,
app_secret:
"asd123"
,
name:
"github"
)
to
receive
(
:get_token
).
and_return
(
token
)
Gitlab
.
config
.
omniauth
.
providers
<<
OpenStruct
.
new
(
app_id:
"asd123"
,
app_secret:
"asd123"
,
name:
"github"
)
get
:callback
get
:callback
expect
(
user
.
reload
.
github_access_token
).
to
eq
(
token
)
expect
(
user
.
reload
.
github_access_token
).
to
eq
(
token
)
expect
(
controller
).
to
redirect_to
(
status_import_github_url
)
expect
(
controller
).
to
redirect_to
(
status_import_github_url
)
end
end
...
@@ -55,7 +58,8 @@ describe Import::GithubController do
...
@@ -55,7 +58,8 @@ describe Import::GithubController do
it
"takes already existing namespace"
do
it
"takes already existing namespace"
do
namespace
=
create
(
:namespace
,
name:
"john"
,
owner:
user
)
namespace
=
create
(
:namespace
,
name:
"john"
,
owner:
user
)
expect
(
Gitlab
::
GithubImport
::
ProjectCreator
).
to
receive
(
:new
).
with
(
@repo
,
namespace
,
user
).
expect
(
Gitlab
::
GithubImport
::
ProjectCreator
).
to
receive
(
:new
).
with
(
@repo
,
namespace
,
user
).
and_return
(
double
(
execute:
true
))
and_return
(
double
(
execute:
true
))
controller
.
stub_chain
(
:client
,
:repo
).
and_return
(
@repo
)
controller
.
stub_chain
(
:client
,
:repo
).
and_return
(
@repo
)
...
...
spec/controllers/import/gitlab_controller_spec.rb
View file @
940a402b
...
@@ -14,7 +14,7 @@ describe Import::GitlabController do
...
@@ -14,7 +14,7 @@ describe Import::GitlabController do
Gitlab
.
config
.
omniauth
.
providers
<<
OpenStruct
.
new
(
app_id:
"asd123"
,
app_secret:
"asd123"
,
name:
"gitlab"
)
Gitlab
.
config
.
omniauth
.
providers
<<
OpenStruct
.
new
(
app_id:
"asd123"
,
app_secret:
"asd123"
,
name:
"gitlab"
)
get
:callback
get
:callback
expect
(
user
.
reload
.
gitlab_access_token
).
to
eq
(
token
)
expect
(
user
.
reload
.
gitlab_access_token
).
to
eq
(
token
)
expect
(
controller
).
to
redirect_to
(
status_import_gitlab_url
)
expect
(
controller
).
to
redirect_to
(
status_import_gitlab_url
)
end
end
...
@@ -28,7 +28,7 @@ describe Import::GitlabController do
...
@@ -28,7 +28,7 @@ describe Import::GitlabController do
it
"assigns variables"
do
it
"assigns variables"
do
@project
=
create
(
:project
,
import_type:
'gitlab'
,
creator_id:
user
.
id
)
@project
=
create
(
:project
,
import_type:
'gitlab'
,
creator_id:
user
.
id
)
controller
.
stub_chain
(
:client
,
:projects
).
and_return
([
@repo
])
controller
.
stub_chain
(
:client
,
:projects
).
and_return
([
@repo
])
get
:status
get
:status
expect
(
assigns
(
:already_added_projects
)).
to
eq
([
@project
])
expect
(
assigns
(
:already_added_projects
)).
to
eq
([
@project
])
...
@@ -38,7 +38,7 @@ describe Import::GitlabController do
...
@@ -38,7 +38,7 @@ describe Import::GitlabController do
it
"does not show already added project"
do
it
"does not show already added project"
do
@project
=
create
(
:project
,
import_type:
'gitlab'
,
creator_id:
user
.
id
,
import_source:
'asd/vim'
)
@project
=
create
(
:project
,
import_type:
'gitlab'
,
creator_id:
user
.
id
,
import_source:
'asd/vim'
)
controller
.
stub_chain
(
:client
,
:projects
).
and_return
([
@repo
])
controller
.
stub_chain
(
:client
,
:projects
).
and_return
([
@repo
])
get
:status
get
:status
expect
(
assigns
(
:already_added_projects
)).
to
eq
([
@project
])
expect
(
assigns
(
:already_added_projects
)).
to
eq
([
@project
])
...
@@ -58,7 +58,8 @@ describe Import::GitlabController do
...
@@ -58,7 +58,8 @@ describe Import::GitlabController do
it
"takes already existing namespace"
do
it
"takes already existing namespace"
do
namespace
=
create
(
:namespace
,
name:
"john"
,
owner:
user
)
namespace
=
create
(
:namespace
,
name:
"john"
,
owner:
user
)
expect
(
Gitlab
::
GitlabImport
::
ProjectCreator
).
to
receive
(
:new
).
with
(
@repo
,
namespace
,
user
).
expect
(
Gitlab
::
GitlabImport
::
ProjectCreator
).
to
receive
(
:new
).
with
(
@repo
,
namespace
,
user
).
and_return
(
double
(
execute:
true
))
and_return
(
double
(
execute:
true
))
controller
.
stub_chain
(
:client
,
:project
).
and_return
(
@repo
)
controller
.
stub_chain
(
:client
,
:project
).
and_return
(
@repo
)
...
...
spec/controllers/merge_requests_controller_spec.rb
View file @
940a402b
...
@@ -31,7 +31,8 @@ describe Projects::MergeRequestsController do
...
@@ -31,7 +31,8 @@ describe Projects::MergeRequestsController do
end
end
it
"should not escape Html"
do
it
"should not escape Html"
do
allow_any_instance_of
(
MergeRequest
).
to
receive
(
:"to_
#{
format
}
"
).
and_return
(
'HTML entities &<>" '
)
allow_any_instance_of
(
MergeRequest
).
to
receive
(
:"to_
#{
format
}
"
).
and_return
(
'HTML entities &<>" '
)
get
:show
,
project_id:
project
.
to_param
,
id:
merge_request
.
iid
,
format:
format
get
:show
,
project_id:
project
.
to_param
,
id:
merge_request
.
iid
,
format:
format
...
...
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