forked from wvanbergen/request-log-analyzer
-
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.
Ref wvanbergen#155 - Millisecond measuring units
- Altered the labeling of durations when <1 second - Altered related specs that cover output to email - Cleaned up a few lines that had trailing whitespace
- Loading branch information
Showing
2 changed files
with
16 additions
and
15 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
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 |
---|---|---|
|
@@ -26,17 +26,17 @@ | |
:format => RequestLogAnalyzer::FileFormat::Rails, | ||
:no_progress => true | ||
).run! | ||
|
||
Process.wait # Wait for mailer to complete | ||
|
||
find_string_in_file("From: <[email protected]>", @log_file).should_not be_nil | ||
find_string_in_file("To: <root@localhost>", @log_file).should_not be_nil | ||
find_string_in_file("From: Request-log-analyzer reporter <[email protected]>", @log_file).should_not be_nil | ||
find_string_in_file("Subject: Request log analyzer report - generated on", @log_file).should_not be_nil | ||
find_string_in_file("Request summary", @log_file).should_not be_nil | ||
find_string_in_file("PeopleControll | 1 | 0.04s | 0.04s | 0.00s | 0.04s | 0.04s | 0.04s-0.04s", @log_file).should_not be_nil | ||
find_string_in_file("People | 1 | 40.30ms | 40.30ms | 0.00ms | 40.30ms | 40.30ms | 40.18ms-41.50ms", @log_file).should_not be_nil | ||
end | ||
|
||
it "should allow a custom mail subject" do | ||
RequestLogAnalyzer::Controller.build( | ||
:mail => 'root@localhost', | ||
|
@@ -46,13 +46,13 @@ | |
:format => RequestLogAnalyzer::FileFormat::Rails, | ||
:no_progress => true | ||
).run! | ||
|
||
Process.wait # Wait for mailer to complete | ||
|
||
find_string_in_file("Subject: TESTSUBJECT", @log_file).should_not be_nil | ||
find_string_in_file("Subject: TESTSUBJECT", @log_file).should_not be_nil | ||
end | ||
|
||
it "should send html mail" do | ||
it "should send html mail" do | ||
RequestLogAnalyzer::Controller.build( | ||
:output => 'HTML', | ||
:mail => 'root@localhost', | ||
|
@@ -61,14 +61,14 @@ | |
:format => RequestLogAnalyzer::FileFormat::Rails, | ||
:no_progress => true | ||
).run! | ||
|
||
Process.wait # Wait for mailer to complete | ||
|
||
find_string_in_file("From: <[email protected]>", @log_file).should_not be_nil | ||
find_string_in_file("To: <root@localhost>", @log_file).should_not be_nil | ||
find_string_in_file("From: Request-log-analyzer reporter <[email protected]>", @log_file).should_not be_nil | ||
find_string_in_file('<h1>Request-log-analyzer summary report</h1>', @log_file).should_not be_nil | ||
find_string_in_file('<td class="alt">0.29s-0.30s</td></tr><tr><td>DashboardController#index.html [GET]</td>', @log_file).should_not be_nil | ||
find_string_in_file('<td class="alt">287.08ms-296.48ms</td></tr><tr><td>DashboardController#index.html [GET]</td>', @log_file).should_not be_nil | ||
end | ||
end | ||
|
||
|
@@ -80,7 +80,7 @@ | |
# | ||
# Included in RLA because original mailtrap puts anoying stuff when called | ||
# through ruby. | ||
# | ||
# | ||
# Mailtrap creates a TCP server that listens on a specified port for SMTP | ||
# clients. Accepts the connection and talks just enough of the SMTP protocol | ||
# for them to deliver a message which it writes to disk. | ||
|
@@ -96,7 +96,7 @@ def initialize( host, port, once, msgfile ) | |
@port = port | ||
@once = once | ||
@msgfile = msgfile | ||
|
||
File.open( @msgfile, "a" ) do |file| | ||
file.puts "\n* Mailtrap started at #{@host}:#{port}\n" | ||
end | ||
|
@@ -113,7 +113,7 @@ class << session | |
def get_line | ||
line = gets | ||
line.chomp! unless line.nil? | ||
line | ||
line | ||
end | ||
end | ||
|
||
|
@@ -123,7 +123,7 @@ def get_line | |
end | ||
|
||
break if @once | ||
end | ||
end | ||
end | ||
|
||
# Write a plain text dump of the incoming email to a text | ||
|
@@ -198,4 +198,4 @@ def serve( connection ) | |
|
||
else | ||
p 'Skipping mailer integration specs, because of missing Process.fork()' | ||
end | ||
end |