forked from lukeredpath/mimic
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow request logging using Rack::CommonLogger
- Loading branch information
1 parent
f2a6181
commit fc63928
Showing
6 changed files
with
35 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
Feature: Logging incoming requests | ||
In order to check that Mimic is working properly or provide further debug information | ||
As a developer | ||
I want to be able to tell Mimic to log incoming requests | ||
|
||
Scenario: Logging to STDOUT | ||
Given I have a mimic specification with: | ||
""" | ||
Mimic.mimic(:port => 11988, :log => $stdout).get("/some/path") | ||
""" | ||
When I make an HTTP GET request to "http://localhost:11988/some/path" | ||
Then I should see "GET /some/path HTTP/1.1" written to STDOUT | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Then /^I should see "([^"]*)" written to STDOUT$/ do |output| | ||
TEST_STDOUT.tap { |io| io.rewind }.read.should include(output) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,15 @@ | ||
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), *%w[.. .. lib])) | ||
|
||
TEST_STDOUT = StringIO.new | ||
|
||
Before do | ||
if test_proxy = ENV["MIMIC_TEST_PROXY"] | ||
HttpClient.use_proxy(test_proxy) | ||
end | ||
end | ||
|
||
$stdout = TEST_STDOUT | ||
end | ||
|
||
After do | ||
$stdout = STDOUT | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters