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
Jérome Perrin
gitlab-ce
Commits
b23a05d0
Commit
b23a05d0
authored
Mar 12, 2016
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add spec for go-import middleware
parent
bb206f94
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
0 deletions
+30
-0
spec/lib/gitlab/middleware/go_spec.rb
spec/lib/gitlab/middleware/go_spec.rb
+30
-0
No files found.
spec/lib/gitlab/middleware/go_spec.rb
0 → 100644
View file @
b23a05d0
require
'spec_helper'
describe
Gitlab
::
Middleware
::
Go
,
lib:
true
do
let
(
:app
)
{
double
(
:app
)
}
let
(
:middleware
)
{
described_class
.
new
(
app
)
}
describe
'#call'
do
describe
'when go-get=0'
do
it
'skips go-import generation'
do
env
=
{
'rack.input'
=>
''
,
'QUERY_STRING'
=>
'go-get=0'
}
expect
(
app
).
to
receive
(
:call
).
with
(
env
).
and_return
(
'no-go'
)
middleware
.
call
(
env
)
end
end
describe
'when go-get=1'
do
it
'returns a document'
do
env
=
{
'rack.input'
=>
''
,
'QUERY_STRING'
=>
'go-get=1'
,
'PATH_INFO'
=>
'/group/project/path'
}
resp
=
middleware
.
call
(
env
)
expect
(
resp
[
0
]).
to
eq
(
200
)
expect
(
resp
[
1
][
'Content-Type'
]).
to
eq
(
'text/html'
)
expected_body
=
"<!DOCTYPE html><html><head><meta content='localhost/group/project git http://localhost/group/project.git' name='go-import'></head></html>
\n
"
expect
(
resp
[
2
].
body
).
to
eq
([
expected_body
])
end
end
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