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
a92693df
Commit
a92693df
authored
Oct 23, 2017
by
Mike Greiling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add InspectRequests helper
parent
b612bcfc
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
5 deletions
+24
-5
lib/gitlab/testing/request_inspector_middleware.rb
lib/gitlab/testing/request_inspector_middleware.rb
+2
-3
spec/features/projects/environments/environment_spec.rb
spec/features/projects/environments/environment_spec.rb
+7
-2
spec/support/inspect_requests.rb
spec/support/inspect_requests.rb
+15
-0
No files found.
lib/gitlab/testing/request_inspector_middleware.rb
View file @
a92693df
...
@@ -30,12 +30,12 @@ module Gitlab
...
@@ -30,12 +30,12 @@ module Gitlab
request_headers
=
env_http_headers
(
env
)
request_headers
=
env_http_headers
(
env
)
status
,
headers
,
body
=
@app
.
call
(
env
)
status
,
headers
,
body
=
@app
.
call
(
env
)
log_response
(
{
log_response
(
OpenStruct
.
new
(
url:
url
,
url:
url
,
status_code:
status
,
status_code:
status
,
request_headers:
request_headers
,
request_headers:
request_headers
,
response_headers:
headers
response_headers:
headers
}
)
)
)
[
status
,
headers
,
body
]
[
status
,
headers
,
body
]
end
end
...
@@ -52,7 +52,6 @@ module Gitlab
...
@@ -52,7 +52,6 @@ module Gitlab
def
log_response
(
response
)
def
log_response
(
response
)
@@logged_requests
.
push
(
response
)
@@logged_requests
.
push
(
response
)
STDOUT
.
puts
response
.
to_json
end
end
end
end
end
end
...
...
spec/features/projects/environments/environment_spec.rb
View file @
a92693df
require
'spec_helper'
require
'spec_helper'
feature
'Environment'
do
feature
'Environment'
do
include
InspectRequests
given
(
:project
)
{
create
(
:project
)
}
given
(
:project
)
{
create
(
:project
)
}
given
(
:user
)
{
create
(
:user
)
}
given
(
:user
)
{
create
(
:user
)
}
given
(
:role
)
{
:developer
}
given
(
:role
)
{
:developer
}
...
@@ -193,11 +195,14 @@ feature 'Environment' do
...
@@ -193,11 +195,14 @@ feature 'Environment' do
create
(
:environment
,
project:
project
,
create
(
:environment
,
project:
project
,
name:
'staging-1.0/review'
,
name:
'staging-1.0/review'
,
state: :available
)
state: :available
)
visit
folder_project_environments_path
(
project
,
id:
'staging-1.0'
)
end
end
it
'renders a correct environment folder'
do
it
'renders a correct environment folder'
do
reqs
=
inspect_requests
do
visit
folder_project_environments_path
(
project
,
id:
'staging-1.0'
)
end
expect
(
reqs
.
first
.
status_code
).
to
eq
(
200
)
expect
(
page
).
to
have_content
(
'Environments / staging-1.0'
)
expect
(
page
).
to
have_content
(
'Environments / staging-1.0'
)
end
end
end
end
...
...
spec/support/inspect_requests.rb
0 → 100644
View file @
a92693df
require_relative
'./wait_for_requests'
module
InspectRequests
extend
self
include
WaitForRequests
def
inspect_requests
Gitlab
::
Testing
::
RequestInspectorMiddleware
.
log_requests!
yield
block_and_wait_for_requests_complete
Gitlab
::
Testing
::
RequestInspectorMiddleware
.
requests
ensure
Gitlab
::
Testing
::
RequestInspectorMiddleware
.
stop_logging!
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