request-log-analyzer 1.13.1 → 1.13.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/bin/console +17 -0
  4. data/lib/cli/command_line_arguments.rb +29 -36
  5. data/lib/cli/database_console.rb +1 -3
  6. data/lib/cli/database_console_init.rb +11 -11
  7. data/lib/cli/progressbar.rb +30 -32
  8. data/lib/cli/tools.rb +20 -23
  9. data/lib/request_log_analyzer.rb +8 -8
  10. data/lib/request_log_analyzer/aggregator.rb +4 -7
  11. data/lib/request_log_analyzer/aggregator/database_inserter.rb +10 -13
  12. data/lib/request_log_analyzer/aggregator/echo.rb +5 -7
  13. data/lib/request_log_analyzer/aggregator/summarizer.rb +15 -18
  14. data/lib/request_log_analyzer/class_level_inheritable_attributes.rb +23 -0
  15. data/lib/request_log_analyzer/controller.rb +36 -42
  16. data/lib/request_log_analyzer/database.rb +4 -6
  17. data/lib/request_log_analyzer/database/base.rb +39 -41
  18. data/lib/request_log_analyzer/database/connection.rb +8 -10
  19. data/lib/request_log_analyzer/database/request.rb +1 -3
  20. data/lib/request_log_analyzer/database/source.rb +0 -2
  21. data/lib/request_log_analyzer/database/warning.rb +4 -6
  22. data/lib/request_log_analyzer/file_format.rb +46 -49
  23. data/lib/request_log_analyzer/file_format/amazon_s3.rb +15 -19
  24. data/lib/request_log_analyzer/file_format/apache.rb +42 -45
  25. data/lib/request_log_analyzer/file_format/delayed_job.rb +13 -15
  26. data/lib/request_log_analyzer/file_format/delayed_job2.rb +9 -11
  27. data/lib/request_log_analyzer/file_format/delayed_job21.rb +9 -11
  28. data/lib/request_log_analyzer/file_format/delayed_job3.rb +5 -8
  29. data/lib/request_log_analyzer/file_format/delayed_job4.rb +5 -8
  30. data/lib/request_log_analyzer/file_format/haproxy.rb +44 -48
  31. data/lib/request_log_analyzer/file_format/merb.rb +13 -17
  32. data/lib/request_log_analyzer/file_format/mysql.rb +21 -25
  33. data/lib/request_log_analyzer/file_format/nginx.rb +0 -2
  34. data/lib/request_log_analyzer/file_format/oink.rb +30 -31
  35. data/lib/request_log_analyzer/file_format/postgresql.rb +11 -15
  36. data/lib/request_log_analyzer/file_format/rack.rb +0 -2
  37. data/lib/request_log_analyzer/file_format/rails.rb +100 -104
  38. data/lib/request_log_analyzer/file_format/rails3.rb +19 -23
  39. data/lib/request_log_analyzer/file_format/rails_development.rb +0 -1
  40. data/lib/request_log_analyzer/file_format/w3c.rb +16 -18
  41. data/lib/request_log_analyzer/filter.rb +0 -2
  42. data/lib/request_log_analyzer/filter/anonymize.rb +4 -7
  43. data/lib/request_log_analyzer/filter/field.rb +3 -6
  44. data/lib/request_log_analyzer/filter/timespan.rb +2 -6
  45. data/lib/request_log_analyzer/line_definition.rb +16 -19
  46. data/lib/request_log_analyzer/log_processor.rb +10 -14
  47. data/lib/request_log_analyzer/mailer.rb +9 -12
  48. data/lib/request_log_analyzer/output.rb +12 -14
  49. data/lib/request_log_analyzer/output/fixed_width.rb +21 -28
  50. data/lib/request_log_analyzer/output/html.rb +11 -14
  51. data/lib/request_log_analyzer/request.rb +53 -33
  52. data/lib/request_log_analyzer/source.rb +2 -5
  53. data/lib/request_log_analyzer/source/log_parser.rb +9 -16
  54. data/lib/request_log_analyzer/tracker.rb +10 -12
  55. data/lib/request_log_analyzer/tracker/duration.rb +4 -6
  56. data/lib/request_log_analyzer/tracker/frequency.rb +9 -11
  57. data/lib/request_log_analyzer/tracker/hourly_spread.rb +8 -11
  58. data/lib/request_log_analyzer/tracker/numeric_value.rb +40 -44
  59. data/lib/request_log_analyzer/tracker/timespan.rb +5 -8
  60. data/lib/request_log_analyzer/tracker/traffic.rb +8 -10
  61. data/lib/request_log_analyzer/version.rb +1 -1
  62. data/request-log-analyzer.gemspec +6 -6
  63. data/spec/integration/command_line_usage_spec.rb +33 -33
  64. data/spec/integration/mailer_spec.rb +181 -185
  65. data/spec/integration/munin_plugins_rails_spec.rb +20 -20
  66. data/spec/integration/scout_spec.rb +40 -41
  67. data/spec/lib/helpers.rb +8 -9
  68. data/spec/lib/macros.rb +2 -4
  69. data/spec/lib/matchers.rb +20 -25
  70. data/spec/lib/mocks.rb +10 -11
  71. data/spec/lib/testing_format.rb +8 -10
  72. data/spec/spec_helper.rb +5 -1
  73. data/spec/unit/aggregator/database_inserter_spec.rb +23 -23
  74. data/spec/unit/aggregator/summarizer_spec.rb +7 -7
  75. data/spec/unit/controller/controller_spec.rb +14 -14
  76. data/spec/unit/controller/log_processor_spec.rb +3 -3
  77. data/spec/unit/database/base_class_spec.rb +36 -37
  78. data/spec/unit/database/connection_spec.rb +10 -10
  79. data/spec/unit/database/database_spec.rb +11 -11
  80. data/spec/unit/file_format/amazon_s3_format_spec.rb +66 -62
  81. data/spec/unit/file_format/apache_format_spec.rb +57 -52
  82. data/spec/unit/file_format/common_regular_expressions_spec.rb +18 -21
  83. data/spec/unit/file_format/delayed_job21_format_spec.rb +22 -16
  84. data/spec/unit/file_format/delayed_job2_format_spec.rb +22 -16
  85. data/spec/unit/file_format/delayed_job3_format_spec.rb +14 -10
  86. data/spec/unit/file_format/delayed_job4_format_spec.rb +14 -10
  87. data/spec/unit/file_format/delayed_job_format_spec.rb +12 -12
  88. data/spec/unit/file_format/file_format_api_spec.rb +19 -19
  89. data/spec/unit/file_format/format_autodetection_spec.rb +7 -7
  90. data/spec/unit/file_format/haproxy_format_spec.rb +53 -49
  91. data/spec/unit/file_format/inheritance_spec.rb +13 -0
  92. data/spec/unit/file_format/line_definition_spec.rb +35 -33
  93. data/spec/unit/file_format/merb_format_spec.rb +13 -11
  94. data/spec/unit/file_format/mysql_format_spec.rb +24 -24
  95. data/spec/unit/file_format/oink_format_spec.rb +29 -29
  96. data/spec/unit/file_format/postgresql_format_spec.rb +9 -9
  97. data/spec/unit/file_format/rack_format_spec.rb +36 -31
  98. data/spec/unit/file_format/rails3_format_spec.rb +46 -46
  99. data/spec/unit/file_format/rails_format_spec.rb +52 -53
  100. data/spec/unit/file_format/w3c_format_spec.rb +27 -24
  101. data/spec/unit/filter/anonymize_filter_spec.rb +7 -7
  102. data/spec/unit/filter/field_filter_spec.rb +26 -26
  103. data/spec/unit/filter/filter_spec.rb +4 -4
  104. data/spec/unit/filter/timespan_filter_spec.rb +22 -22
  105. data/spec/unit/mailer_spec.rb +21 -21
  106. data/spec/unit/request_spec.rb +29 -29
  107. data/spec/unit/source/log_parser_spec.rb +5 -5
  108. data/spec/unit/tracker/duration_tracker_spec.rb +23 -23
  109. data/spec/unit/tracker/frequency_tracker_spec.rb +29 -30
  110. data/spec/unit/tracker/hourly_spread_spec.rb +35 -35
  111. data/spec/unit/tracker/numeric_value_tracker_spec.rb +71 -72
  112. data/spec/unit/tracker/timespan_tracker_spec.rb +31 -31
  113. data/spec/unit/tracker/tracker_api_spec.rb +43 -44
  114. data/spec/unit/tracker/traffic_tracker_spec.rb +7 -7
  115. metadata +38 -35
@@ -1,19 +1,19 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe RequestLogAnalyzer, 'when harvesting like munin-plugins-rails the YAML output' do
4
-
5
- before(:each) do
6
- cleanup_temp_files!
4
+
5
+ before(:each) do
6
+ cleanup_temp_files!
7
7
  run("#{log_fixture(:rails_1x)} --dump #{temp_output_file(:yaml)}")
8
- @rla = YAML::load(File.read(temp_output_file(:yaml)))
8
+ @rla = YAML.load(File.read(temp_output_file(:yaml)))
9
9
  end
10
-
10
+
11
11
  after(:each) do
12
12
  cleanup_temp_files!
13
13
  end
14
-
15
- it "should contain database times" do
16
- @rla["Database time"].each do |item|
14
+
15
+ it 'should contain database times' do
16
+ @rla['Database time'].each do |item|
17
17
  item[1][:min].should_not be_nil
18
18
  item[1][:max].should_not be_nil
19
19
  item[1][:hits].should_not be_nil
@@ -21,8 +21,8 @@ describe RequestLogAnalyzer, 'when harvesting like munin-plugins-rails the YAML
21
21
  end
22
22
  end
23
23
 
24
- it "should contain request times" do
25
- @rla["Request duration"].each do |item|
24
+ it 'should contain request times' do
25
+ @rla['Request duration'].each do |item|
26
26
  item[1][:min].should_not be_nil
27
27
  item[1][:max].should_not be_nil
28
28
  item[1][:hits].should_not be_nil
@@ -30,24 +30,24 @@ describe RequestLogAnalyzer, 'when harvesting like munin-plugins-rails the YAML
30
30
  end
31
31
  end
32
32
 
33
- it "should contain failed requests" do
34
- @rla.keys.should include("Failed requests")
33
+ it 'should contain failed requests' do
34
+ @rla.keys.should include('Failed requests')
35
35
  end
36
36
 
37
- it "should contain Process blockers" do
38
- @rla.keys.should include("Process blockers (> 1 sec duration)")
37
+ it 'should contain Process blockers' do
38
+ @rla.keys.should include('Process blockers (> 1 sec duration)')
39
39
  end
40
40
 
41
- it "should contain HTTP Methods" do
42
- @rla["HTTP methods"]["GET"].should_not be_nil
41
+ it 'should contain HTTP Methods' do
42
+ @rla['HTTP methods']['GET'].should_not be_nil
43
43
  end
44
44
 
45
- it "should contain HTTP Methods" do
46
- @rla["HTTP methods"]["GET"].should_not be_nil
45
+ it 'should contain HTTP Methods' do
46
+ @rla['HTTP methods']['GET'].should_not be_nil
47
47
  end
48
48
 
49
- it "should contain view rendering times" do
50
- @rla["View rendering time"].each do |item|
49
+ it 'should contain view rendering times' do
50
+ @rla['View rendering time'].each do |item|
51
51
  item[1][:min].should_not be_nil
52
52
  item[1][:max].should_not be_nil
53
53
  item[1][:hits].should_not be_nil
@@ -10,11 +10,11 @@ ensure
10
10
  end
11
11
 
12
12
  describe RequestLogAnalyzer, 'when using the rla API like the scout plugin' do
13
-
13
+
14
14
  before(:each) do
15
15
  # prepare a place to capture the output
16
16
  sio = StringIO.new
17
-
17
+
18
18
  # place an IO object where I want RequestLogAnalyzer to read from
19
19
  open(log_fixture(:rails_1x)) do |log|
20
20
  completed_count = 0
@@ -22,49 +22,49 @@ describe RequestLogAnalyzer, 'when using the rla API like the scout plugin' do
22
22
  completed_count += 1 if line =~ /\ACompleted\b/
23
23
  break if completed_count == 2 # skipping first two requests
24
24
  end
25
-
25
+
26
26
  # trigger the log parse
27
27
  @stdout, @stderr = capture_stdout_and_stderr_with_warnings_on do
28
28
  RequestLogAnalyzer::Controller.build(
29
- :output => EmbeddedHTML,
30
- :file => sio,
31
- :after => Time.local(2008, 8, 14, 21, 16, 31), # after 3rd req
32
- :source_files => log,
33
- :format => RequestLogAnalyzer::FileFormat::Rails
29
+ output: EmbeddedHTML,
30
+ file: sio,
31
+ after: Time.local(2008, 8, 14, 21, 16, 31), # after 3rd req
32
+ source_files: log,
33
+ format: RequestLogAnalyzer::FileFormat::Rails
34
34
  ).run!
35
35
  end
36
36
  end
37
-
37
+
38
38
  # read the resulting output
39
39
  @analysis = sio.string
40
40
  end
41
-
42
- it "should generate an analysis" do
41
+
42
+ it 'should generate an analysis' do
43
43
  @analysis.should_not be_empty
44
44
  end
45
-
46
- it "should generate customized output using the passed Class" do
45
+
46
+ it 'should generate customized output using the passed Class' do
47
47
  credit = %r{<p>Powered by request-log-analyzer v\d+(?:\.\d+)+</p>\z}
48
48
  @analysis.should match(credit)
49
49
  end
50
-
51
- it "should skip requests before :after Time" do
52
- @analysis.should_not include("PeopleController#show")
50
+
51
+ it 'should skip requests before :after Time' do
52
+ @analysis.should_not include('PeopleController#show')
53
53
  end
54
-
55
- it "should include requests after IO#pos and :after Time" do
56
- @analysis.should include("PeopleController#picture")
54
+
55
+ it 'should include requests after IO#pos and :after Time' do
56
+ @analysis.should include('PeopleController#picture')
57
57
  end
58
-
59
- it "should skip requests before IO#pos" do
60
- @analysis.should_not include("PeopleController#index")
58
+
59
+ it 'should skip requests before IO#pos' do
60
+ @analysis.should_not include('PeopleController#index')
61
61
  end
62
-
63
- it "should not print to $stdout" do
62
+
63
+ it 'should not print to $stdout' do
64
64
  @stdout.should be_empty
65
65
  end
66
-
67
- it "should not print to $stderr (with warnings on)" do
66
+
67
+ it 'should not print to $stderr (with warnings on)' do
68
68
  @stderr.should be_empty
69
69
  end
70
70
 
@@ -77,7 +77,7 @@ class EmbeddedHTML < RequestLogAnalyzer::Output::Base
77
77
  end
78
78
  alias_method :<<, :print
79
79
 
80
- def puts(str = "")
80
+ def puts(str = '')
81
81
  @io << "#{str}<br/>\n"
82
82
  end
83
83
 
@@ -85,20 +85,20 @@ class EmbeddedHTML < RequestLogAnalyzer::Output::Base
85
85
  @io.puts(tag(:h2, title))
86
86
  end
87
87
 
88
- def line(*font)
88
+ def line(*_font)
89
89
  @io.puts(tag(:hr))
90
90
  end
91
91
 
92
92
  def link(text, url = nil)
93
93
  url = text if url.nil?
94
- tag(:a, text, :href => url)
94
+ tag(:a, text, href: url)
95
95
  end
96
96
 
97
- def table(*columns, &block)
98
- rows = Array.new
97
+ def table(*columns, &_block)
98
+ rows = []
99
99
  yield(rows)
100
100
 
101
- @io << tag(:table, :cellspacing => 0) do |content|
101
+ @io << tag(:table, cellspacing: 0) do |content|
102
102
  if table_has_header?(columns)
103
103
  content << tag(:tr) do
104
104
  columns.map { |col| tag(:th, col[:title]) }.join("\n")
@@ -110,9 +110,9 @@ class EmbeddedHTML < RequestLogAnalyzer::Output::Base
110
110
  odd = !odd
111
111
  content << tag(:tr) do
112
112
  if odd
113
- row.map { |cell| tag(:td, cell, :class => "alt") }.join("\n")
113
+ row.map { |cell| tag(:td, cell, class: 'alt') }.join("\n")
114
114
  else
115
- row.map { |cell| tag(:td, cell) }.join("\n")
115
+ row.map { |cell| tag(:td, cell) }.join("\n")
116
116
  end
117
117
  end
118
118
  end
@@ -130,23 +130,22 @@ class EmbeddedHTML < RequestLogAnalyzer::Output::Base
130
130
 
131
131
  def tag(tag, content = nil, attributes = nil)
132
132
  if block_given?
133
- attributes = content.nil? ? "" : " " + content.map { |(key, value)| "#{key}=\"#{value}\"" }.join(" ")
134
- content_string = ""
133
+ attributes = content.nil? ? '' : ' ' + content.map { |(key, value)| "#{key}=\"#{value}\"" }.join(' ')
134
+ content_string = ''
135
135
  content = yield(content_string)
136
- content = content_string unless content_string.empty?
136
+ content = content_string unless content_string.empty?
137
137
  "<#{tag}#{attributes}>#{content}</#{tag}>"
138
138
  else
139
- attributes = attributes.nil? ? "" : " " + attributes.map { |(key, value)| "#{key}=\"#{value}\"" }.join(" ")
139
+ attributes = attributes.nil? ? '' : ' ' + attributes.map { |(key, value)| "#{key}=\"#{value}\"" }.join(' ')
140
140
  if content.nil?
141
141
  "<#{tag}#{attributes} />"
142
142
  else
143
143
  if content.class == Float
144
- "<#{tag}#{attributes}><div class='color_bar' style=\"width:#{(content*200).floor}px;\"/></#{tag}>"
144
+ "<#{tag}#{attributes}><div class='color_bar' style=\"width:#{(content * 200).floor}px;\"/></#{tag}>"
145
145
  else
146
146
  "<#{tag}#{attributes}>#{content}</#{tag}>"
147
147
  end
148
148
  end
149
149
  end
150
- end
150
+ end
151
151
  end
152
-
@@ -1,12 +1,11 @@
1
1
  module RequestLogAnalyzer::RSpec::Helpers
2
-
3
2
  # Create or return a new TestingFormat
4
3
  def testing_format
5
4
  @testing_format ||= TestingFormat.create
6
5
  end
7
6
 
8
7
  # Load a log file from the fixture folder
9
- def log_fixture(name, extention = "log")
8
+ def log_fixture(name, extention = 'log')
10
9
  File.dirname(__FILE__) + "/../fixtures/#{name}.#{extention}"
11
10
  end
12
11
 
@@ -22,7 +21,7 @@ module RequestLogAnalyzer::RSpec::Helpers
22
21
 
23
22
  # Request loopback
24
23
  def request(fields, format = testing_format)
25
- if fields.kind_of?(Array)
24
+ if fields.is_a?(Array)
26
25
  format.request(*fields)
27
26
  else
28
27
  format.request(fields)
@@ -33,7 +32,7 @@ module RequestLogAnalyzer::RSpec::Helpers
33
32
  # Used to call request-log-analyzer through binary
34
33
  def run(arguments)
35
34
  binary = "#{File.dirname(__FILE__)}/../../bin/request-log-analyzer"
36
- arguments = arguments.join(' ') if arguments.kind_of?(Array)
35
+ arguments = arguments.join(' ') if arguments.is_a?(Array)
37
36
 
38
37
  output = []
39
38
  IO.popen("#{binary} #{arguments} 2>&1") do |pipe|
@@ -58,20 +57,20 @@ module RequestLogAnalyzer::RSpec::Helpers
58
57
  # Check if a given string can be found in the given file
59
58
  # Returns the line number if found, nil otherwise
60
59
  def find_string_in_file(string, file, options = {})
61
- return nil unless File.exists?(file)
60
+ return nil unless File.exist?(file)
62
61
 
63
62
  line_counter = 0
64
63
 
65
- File.open( file ) do |io|
66
- io.each {|line|
64
+ File.open(file) do |io|
65
+ io.each do|line|
67
66
  line_counter += 1
68
67
  line.chomp!
69
68
 
70
69
  p line if options[:debug]
71
70
  return line_counter if line.include? string
72
- }
71
+ end
73
72
  end
74
73
 
75
- return nil
74
+ nil
76
75
  end
77
76
  end
@@ -1,9 +1,8 @@
1
1
  module RequestLogAnalyzer::RSpec::Macros
2
-
3
2
  def test_databases
4
3
  require 'yaml'
5
4
  hash = YAML.load(File.read("#{File.dirname(__FILE__)}/../database.yml"))
6
- hash.inject({}) { |res, (name, h)| res[name] = h.map { |(k,v)| "#{k}=#{v}" }.join(';'); res }
5
+ hash.reduce({}) { |res, (name, h)| res[name] = h.map { |(k, v)| "#{k}=#{v}" }.join(';'); res }
7
6
  end
8
7
 
9
8
  # Create or return a new TestingFormat
@@ -12,7 +11,6 @@ module RequestLogAnalyzer::RSpec::Macros
12
11
  end
13
12
 
14
13
  def default_orm_class_names
15
- ['Warning', 'Request', 'Source']
14
+ %w(Warning Request Source)
16
15
  end
17
-
18
16
  end
@@ -1,7 +1,5 @@
1
1
  module RequestLogAnalyzer::RSpec::Matchers
2
-
3
2
  class HasLineDefinition
4
-
5
3
  def initialize(line_type)
6
4
  @line_type = line_type.to_sym
7
5
  @captures = []
@@ -9,11 +7,11 @@ module RequestLogAnalyzer::RSpec::Matchers
9
7
 
10
8
  def and_capture(*captures)
11
9
  @captures += captures
12
- return self
10
+ self
13
11
  end
14
-
12
+
15
13
  alias_method :capturing, :and_capture
16
-
14
+
17
15
  def description
18
16
  description = "have a #{@line_type.inspect} line definition"
19
17
  description << " that captures #{@captures.join(', ')}" unless @captures.empty?
@@ -21,7 +19,7 @@ module RequestLogAnalyzer::RSpec::Matchers
21
19
  end
22
20
 
23
21
  def matches?(file_format)
24
- file_format = file_format.create if file_format.kind_of?(Class)
22
+ file_format = file_format.create if file_format.is_a?(Class)
25
23
  if ld = file_format.line_definitions[@line_type]
26
24
  @captures.all? { |c| ld.all_captured_variables.include?(c) }
27
25
  else
@@ -31,7 +29,6 @@ module RequestLogAnalyzer::RSpec::Matchers
31
29
  end
32
30
 
33
31
  class ParseLine
34
-
35
32
  def initialize(line, line_description = nil)
36
33
  @line = line
37
34
  @captures = {}
@@ -41,39 +38,37 @@ module RequestLogAnalyzer::RSpec::Matchers
41
38
 
42
39
  def line_description
43
40
  @full_line_description ||= if @line_description
44
- if @line_type && @line_description =~ /^(?:with|without|having|using) /
45
- "a #{@line_type.inspect} line #{@line_description}"
46
- else
47
- @line_description
48
- end
49
- elsif @line_type
50
- "a #{@line_type.inspect} line"
41
+ if @line_type && @line_description =~ /^(?:with|without|having|using) /
42
+ "a #{@line_type.inspect} line #{@line_description}"
43
+ else
44
+ @line_description
45
+ end
46
+ elsif @line_type
47
+ "a #{@line_type.inspect} line"
51
48
  else
52
49
  "line #{@line.inspect}"
53
50
  end
54
51
  end
55
52
 
56
- def failure_message
57
- @failure_message
58
- end
53
+ attr_reader :failure_message
59
54
 
60
55
  def as(line_type)
61
56
  @line_type = line_type
62
- return self
57
+ self
63
58
  end
64
-
59
+
65
60
  def and_capture(captures)
66
61
  @captures = captures
67
- return self
62
+ self
68
63
  end
69
-
64
+
70
65
  alias_method :capturing, :and_capture
71
66
 
72
67
  def fail(message)
73
68
  @failure_message = message
74
- return false
69
+ false
75
70
  end
76
-
71
+
77
72
  def description
78
73
  description = "parse #{line_description}"
79
74
  description << " as line type #{@line_type.inspect}" if @line_type
@@ -93,13 +88,13 @@ module RequestLogAnalyzer::RSpec::Matchers
93
88
  return fail("The line should match the #{@line_type.inspect} line definition, but matched #{@line_hash[:line_definition].name.inspect} instead.")
94
89
  end
95
90
  else
96
- return fail("The line did not match any line definition.")
91
+ return fail('The line did not match any line definition.')
97
92
  end
98
93
  end
99
94
  end
100
95
 
101
96
  def have_line_definition(line_type)
102
- return HasLineDefinition.new(line_type)
97
+ HasLineDefinition.new(line_type)
103
98
  end
104
99
 
105
100
  def parse_line(line, line_description = nil)
@@ -1,5 +1,4 @@
1
1
  module RequestLogAnalyzer::RSpec::Mocks
2
-
3
2
  def mock_source
4
3
  source = double('RequestLogAnalyzer::Source::Base')
5
4
  source.stub(:file_format).and_return(testing_format)
@@ -15,10 +14,10 @@ module RequestLogAnalyzer::RSpec::Mocks
15
14
  source.stub(:finalize)
16
15
 
17
16
  source.stub(:each_request).
18
- and_yield(testing_format.request(:field => 'value1')).
19
- and_yield(testing_format.request(:field => 'value2'))
17
+ and_yield(testing_format.request(field: 'value1')).
18
+ and_yield(testing_format.request(field: 'value2'))
20
19
 
21
- return source
20
+ source
22
21
  end
23
22
 
24
23
  def mock_io
@@ -26,7 +25,7 @@ module RequestLogAnalyzer::RSpec::Mocks
26
25
  mio.stub(:print)
27
26
  mio.stub(:puts)
28
27
  mio.stub(:write)
29
- return mio
28
+ mio
30
29
  end
31
30
 
32
31
  def mock_output
@@ -36,7 +35,7 @@ module RequestLogAnalyzer::RSpec::Mocks
36
35
  output.stub(:footer)
37
36
  output.stub(:puts)
38
37
  output.stub(:<<)
39
- output.stub(:colorize).and_return("Fancy text")
38
+ output.stub(:colorize).and_return('Fancy text')
40
39
  output.stub(:link)
41
40
  output.stub(:title)
42
41
  output.stub(:line)
@@ -44,8 +43,8 @@ module RequestLogAnalyzer::RSpec::Mocks
44
43
  output.stub(:table).and_yield([])
45
44
  output.stub(:io).and_return(mock_io)
46
45
  output.stub(:options).and_return({})
47
- output.stub(:slice_results).and_return { |a| a }
48
- return output
46
+ output.stub(:slice_results) { |a| a }
47
+ output
49
48
  end
50
49
 
51
50
  def mock_database(*stubs)
@@ -53,8 +52,8 @@ module RequestLogAnalyzer::RSpec::Mocks
53
52
  database.stub(:connect)
54
53
  database.stub(:disconnect)
55
54
  database.stub(:connection).and_return(mock_connection)
56
- stubs.each { |s| database.stub(s)}
57
- return database
55
+ stubs.each { |s| database.stub(s) }
56
+ database
58
57
  end
59
58
 
60
59
  def mock_connection
@@ -67,6 +66,6 @@ module RequestLogAnalyzer::RSpec::Mocks
67
66
  connection.stub(:table_exists?).and_return(false)
68
67
  connection.stub(:create_table).and_yield(table_creator).and_return(true)
69
68
  connection.stub(:table_creator).and_return(table_creator)
70
- return connection
69
+ connection
71
70
  end
72
71
  end