BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
a92693df
Unverified
Commit
a92693df
authored
Oct 23, 2017
by
Mike Greiling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add InspectRequests helper
parent
b612bcfc
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
4 deletions
+23
-4
request_inspector_middleware.rb
lib/gitlab/testing/request_inspector_middleware.rb
+2
-3
environment_spec.rb
spec/features/projects/environments/environment_spec.rb
+6
-1
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
request_headers
=
env_http_headers
(
env
)
status
,
headers
,
body
=
@app
.
call
(
env
)
log_response
(
{
log_response
(
OpenStruct
.
new
(
url:
url
,
status_code:
status
,
request_headers:
request_headers
,
response_headers:
headers
}
)
)
)
[
status
,
headers
,
body
]
end
...
...
@@ -52,7 +52,6 @@ module Gitlab
def
log_response
(
response
)
@@logged_requests
.
push
(
response
)
STDOUT
.
puts
response
.
to_json
end
end
end
...
...
spec/features/projects/environments/environment_spec.rb
View file @
a92693df
require
'spec_helper'
feature
'Environment'
do
include
InspectRequests
given
(
:project
)
{
create
(
:project
)
}
given
(
:user
)
{
create
(
:user
)
}
given
(
:role
)
{
:developer
}
...
...
@@ -193,11 +195,14 @@ feature 'Environment' do
create
(
:environment
,
project:
project
,
name:
'staging-1.0/review'
,
state: :available
)
end
it
'renders a correct environment folder'
do
reqs
=
inspect_requests
do
visit
folder_project_environments_path
(
project
,
id:
'staging-1.0'
)
end
it
'renders a correct environment folder'
do
expect
(
reqs
.
first
.
status_code
).
to
eq
(
200
)
expect
(
page
).
to
have_content
(
'Environments / staging-1.0'
)
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