honkster-newrelic_rpm 2.13.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +462 -0
- data/LICENSE +37 -0
- data/README.rdoc +172 -0
- data/bin/mongrel_rpm +33 -0
- data/bin/newrelic +13 -0
- data/bin/newrelic_cmd +5 -0
- data/cert/cacert.pem +34 -0
- data/install.rb +9 -0
- data/lib/new_relic/agent.rb +382 -0
- data/lib/new_relic/agent/agent.rb +741 -0
- data/lib/new_relic/agent/busy_calculator.rb +91 -0
- data/lib/new_relic/agent/chained_call.rb +13 -0
- data/lib/new_relic/agent/error_collector.rb +131 -0
- data/lib/new_relic/agent/instrumentation/active_merchant.rb +18 -0
- data/lib/new_relic/agent/instrumentation/active_record_instrumentation.rb +92 -0
- data/lib/new_relic/agent/instrumentation/acts_as_solr.rb +45 -0
- data/lib/new_relic/agent/instrumentation/authlogic.rb +8 -0
- data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +409 -0
- data/lib/new_relic/agent/instrumentation/data_mapper.rb +58 -0
- data/lib/new_relic/agent/instrumentation/delayed_job_instrumentation.rb +22 -0
- data/lib/new_relic/agent/instrumentation/memcache.rb +40 -0
- data/lib/new_relic/agent/instrumentation/merb/controller.rb +26 -0
- data/lib/new_relic/agent/instrumentation/merb/errors.rb +9 -0
- data/lib/new_relic/agent/instrumentation/metric_frame.rb +319 -0
- data/lib/new_relic/agent/instrumentation/net.rb +17 -0
- data/lib/new_relic/agent/instrumentation/passenger_instrumentation.rb +22 -0
- data/lib/new_relic/agent/instrumentation/rack.rb +98 -0
- data/lib/new_relic/agent/instrumentation/rails/action_controller.rb +59 -0
- data/lib/new_relic/agent/instrumentation/rails/action_web_service.rb +27 -0
- data/lib/new_relic/agent/instrumentation/rails/errors.rb +24 -0
- data/lib/new_relic/agent/instrumentation/rails3/action_controller.rb +45 -0
- data/lib/new_relic/agent/instrumentation/rails3/errors.rb +21 -0
- data/lib/new_relic/agent/instrumentation/sinatra.rb +46 -0
- data/lib/new_relic/agent/instrumentation/sunspot.rb +17 -0
- data/lib/new_relic/agent/instrumentation/unicorn_instrumentation.rb +10 -0
- data/lib/new_relic/agent/method_tracer.rb +350 -0
- data/lib/new_relic/agent/sampler.rb +50 -0
- data/lib/new_relic/agent/samplers/cpu_sampler.rb +54 -0
- data/lib/new_relic/agent/samplers/delayed_job_lock_sampler.rb +37 -0
- data/lib/new_relic/agent/samplers/memory_sampler.rb +142 -0
- data/lib/new_relic/agent/samplers/object_sampler.rb +24 -0
- data/lib/new_relic/agent/shim_agent.rb +25 -0
- data/lib/new_relic/agent/stats_engine.rb +24 -0
- data/lib/new_relic/agent/stats_engine/metric_stats.rb +118 -0
- data/lib/new_relic/agent/stats_engine/samplers.rb +83 -0
- data/lib/new_relic/agent/stats_engine/transactions.rb +149 -0
- data/lib/new_relic/agent/transaction_sampler.rb +330 -0
- data/lib/new_relic/agent/worker_loop.rb +81 -0
- data/lib/new_relic/collection_helper.rb +71 -0
- data/lib/new_relic/command.rb +85 -0
- data/lib/new_relic/commands/deployments.rb +105 -0
- data/lib/new_relic/commands/install.rb +81 -0
- data/lib/new_relic/control.rb +203 -0
- data/lib/new_relic/control/configuration.rb +149 -0
- data/lib/new_relic/control/frameworks/external.rb +13 -0
- data/lib/new_relic/control/frameworks/merb.rb +24 -0
- data/lib/new_relic/control/frameworks/rails.rb +126 -0
- data/lib/new_relic/control/frameworks/rails3.rb +60 -0
- data/lib/new_relic/control/frameworks/ruby.rb +36 -0
- data/lib/new_relic/control/frameworks/sinatra.rb +18 -0
- data/lib/new_relic/control/instrumentation.rb +95 -0
- data/lib/new_relic/control/logging_methods.rb +74 -0
- data/lib/new_relic/control/profiling.rb +24 -0
- data/lib/new_relic/control/server_methods.rb +88 -0
- data/lib/new_relic/delayed_job_injection.rb +27 -0
- data/lib/new_relic/histogram.rb +91 -0
- data/lib/new_relic/local_environment.rb +333 -0
- data/lib/new_relic/merbtasks.rb +6 -0
- data/lib/new_relic/metric_data.rb +42 -0
- data/lib/new_relic/metric_parser.rb +136 -0
- data/lib/new_relic/metric_parser/action_mailer.rb +9 -0
- data/lib/new_relic/metric_parser/active_merchant.rb +26 -0
- data/lib/new_relic/metric_parser/active_record.rb +28 -0
- data/lib/new_relic/metric_parser/apdex.rb +88 -0
- data/lib/new_relic/metric_parser/controller.rb +62 -0
- data/lib/new_relic/metric_parser/controller_cpu.rb +38 -0
- data/lib/new_relic/metric_parser/errors.rb +6 -0
- data/lib/new_relic/metric_parser/external.rb +50 -0
- data/lib/new_relic/metric_parser/mem_cache.rb +50 -0
- data/lib/new_relic/metric_parser/other_transaction.rb +36 -0
- data/lib/new_relic/metric_parser/view.rb +61 -0
- data/lib/new_relic/metric_parser/web_frontend.rb +14 -0
- data/lib/new_relic/metric_parser/web_service.rb +9 -0
- data/lib/new_relic/metric_spec.rb +67 -0
- data/lib/new_relic/metrics.rb +9 -0
- data/lib/new_relic/noticed_error.rb +24 -0
- data/lib/new_relic/rack/developer_mode.rb +257 -0
- data/lib/new_relic/rack/metric_app.rb +64 -0
- data/lib/new_relic/rack/mongrel_rpm.ru +26 -0
- data/lib/new_relic/rack/newrelic.yml +27 -0
- data/lib/new_relic/rack_app.rb +6 -0
- data/lib/new_relic/recipes.rb +82 -0
- data/lib/new_relic/stats.rb +368 -0
- data/lib/new_relic/timer_lib.rb +27 -0
- data/lib/new_relic/transaction_analysis.rb +119 -0
- data/lib/new_relic/transaction_sample.rb +586 -0
- data/lib/new_relic/url_rule.rb +14 -0
- data/lib/new_relic/version.rb +55 -0
- data/lib/new_relic_api.rb +276 -0
- data/lib/newrelic_rpm.rb +49 -0
- data/lib/tasks/all.rb +4 -0
- data/lib/tasks/install.rake +7 -0
- data/lib/tasks/tests.rake +15 -0
- data/newrelic.yml +246 -0
- data/newrelic_rpm.gemspec +254 -0
- data/recipes/newrelic.rb +6 -0
- data/test/active_record_fixtures.rb +55 -0
- data/test/config/newrelic.yml +48 -0
- data/test/config/test_control.rb +36 -0
- data/test/new_relic/agent/active_record_instrumentation_test.rb +286 -0
- data/test/new_relic/agent/agent_controller_test.rb +294 -0
- data/test/new_relic/agent/agent_test_controller.rb +77 -0
- data/test/new_relic/agent/busy_calculator_test.rb +81 -0
- data/test/new_relic/agent/collection_helper_test.rb +125 -0
- data/test/new_relic/agent/error_collector_test.rb +163 -0
- data/test/new_relic/agent/memcache_instrumentation_test.rb +103 -0
- data/test/new_relic/agent/method_tracer_test.rb +340 -0
- data/test/new_relic/agent/metric_data_test.rb +53 -0
- data/test/new_relic/agent/metric_frame_test.rb +51 -0
- data/test/new_relic/agent/mock_scope_listener.rb +23 -0
- data/test/new_relic/agent/net_instrumentation_test.rb +77 -0
- data/test/new_relic/agent/rpm_agent_test.rb +142 -0
- data/test/new_relic/agent/stats_engine/metric_stats_test.rb +79 -0
- data/test/new_relic/agent/stats_engine/samplers_test.rb +72 -0
- data/test/new_relic/agent/stats_engine/stats_engine_test.rb +184 -0
- data/test/new_relic/agent/task_instrumentation_test.rb +188 -0
- data/test/new_relic/agent/testable_agent.rb +13 -0
- data/test/new_relic/agent/transaction_sample_builder_test.rb +195 -0
- data/test/new_relic/agent/transaction_sample_test.rb +192 -0
- data/test/new_relic/agent/transaction_sampler_test.rb +385 -0
- data/test/new_relic/agent/worker_loop_test.rb +66 -0
- data/test/new_relic/control_test.rb +127 -0
- data/test/new_relic/deployments_api_test.rb +69 -0
- data/test/new_relic/environment_test.rb +75 -0
- data/test/new_relic/metric_parser_test.rb +226 -0
- data/test/new_relic/metric_spec_test.rb +177 -0
- data/test/new_relic/rack/episodes_test.rb +318 -0
- data/test/new_relic/shim_agent_test.rb +9 -0
- data/test/new_relic/stats_test.rb +312 -0
- data/test/new_relic/version_number_test.rb +89 -0
- data/test/test_contexts.rb +28 -0
- data/test/test_helper.rb +72 -0
- data/ui/helpers/developer_mode_helper.rb +359 -0
- data/ui/helpers/google_pie_chart.rb +49 -0
- data/ui/views/layouts/newrelic_default.rhtml +47 -0
- data/ui/views/newrelic/_explain_plans.rhtml +27 -0
- data/ui/views/newrelic/_sample.rhtml +20 -0
- data/ui/views/newrelic/_segment.rhtml +29 -0
- data/ui/views/newrelic/_segment_limit_message.rhtml +1 -0
- data/ui/views/newrelic/_segment_row.rhtml +14 -0
- data/ui/views/newrelic/_show_sample_detail.rhtml +24 -0
- data/ui/views/newrelic/_show_sample_sql.rhtml +20 -0
- data/ui/views/newrelic/_show_sample_summary.rhtml +3 -0
- data/ui/views/newrelic/_sql_row.rhtml +16 -0
- data/ui/views/newrelic/_stack_trace.rhtml +15 -0
- data/ui/views/newrelic/_table.rhtml +12 -0
- data/ui/views/newrelic/explain_sql.rhtml +43 -0
- data/ui/views/newrelic/file/images/arrow-close.png +0 -0
- data/ui/views/newrelic/file/images/arrow-open.png +0 -0
- data/ui/views/newrelic/file/images/blue_bar.gif +0 -0
- data/ui/views/newrelic/file/images/file_icon.png +0 -0
- data/ui/views/newrelic/file/images/gray_bar.gif +0 -0
- data/ui/views/newrelic/file/images/new-relic-rpm-desktop.gif +0 -0
- data/ui/views/newrelic/file/images/new_relic_rpm_desktop.gif +0 -0
- data/ui/views/newrelic/file/images/textmate.png +0 -0
- data/ui/views/newrelic/file/javascript/jquery-1.4.2.js +6240 -0
- data/ui/views/newrelic/file/javascript/transaction_sample.js +120 -0
- data/ui/views/newrelic/file/stylesheets/style.css +484 -0
- data/ui/views/newrelic/index.rhtml +59 -0
- data/ui/views/newrelic/sample_not_found.rhtml +2 -0
- data/ui/views/newrelic/show_sample.rhtml +79 -0
- data/ui/views/newrelic/show_source.rhtml +3 -0
- data/ui/views/newrelic/threads.rhtml +52 -0
- metadata +307 -0
@@ -0,0 +1,177 @@
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__),'..', 'test_helper'))
|
2
|
+
##require "new_relic/stats"
|
3
|
+
class NewRelic::MetricSpecTest < Test::Unit::TestCase
|
4
|
+
|
5
|
+
def test_simple
|
6
|
+
stats = NewRelic::MethodTraceStats.new
|
7
|
+
validate stats, 0, 0, 0, 0
|
8
|
+
|
9
|
+
assert_equal stats.call_count,0
|
10
|
+
stats.trace_call 10
|
11
|
+
stats.trace_call 20
|
12
|
+
stats.trace_call 30
|
13
|
+
|
14
|
+
validate stats, 3, (10+20+30), 10, 30
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_equal
|
18
|
+
spec1 = NewRelic::MetricSpec.new('Controller')
|
19
|
+
spec2 = NewRelic::MetricSpec.new('Controller', nil)
|
20
|
+
|
21
|
+
assert spec1.eql?(NewRelic::MetricSpec.new('Controller'))
|
22
|
+
assert spec2.eql?(NewRelic::MetricSpec.new('Controller', nil))
|
23
|
+
assert spec1.eql?(spec2)
|
24
|
+
assert !spec2.eql?(NewRelic::MetricSpec.new('Controller', '/dude'))
|
25
|
+
end
|
26
|
+
|
27
|
+
define_method(:'test_<=>') do
|
28
|
+
s1 = NewRelic::MetricSpec.new('ActiveRecord')
|
29
|
+
s2 = NewRelic::MetricSpec.new('Controller')
|
30
|
+
assert_equal [s1, s2].sort, [s1,s2]
|
31
|
+
assert_equal [s2, s1].sort, [s1,s2]
|
32
|
+
|
33
|
+
s1 = NewRelic::MetricSpec.new('Controller', nil)
|
34
|
+
s2 = NewRelic::MetricSpec.new('Controller', 'hap')
|
35
|
+
assert_equal [s2, s1].sort, [s1, s2]
|
36
|
+
assert_equal [s1, s2].sort, [s1, s2]
|
37
|
+
|
38
|
+
s1 = NewRelic::MetricSpec.new('Controller', 'hap')
|
39
|
+
s2 = NewRelic::MetricSpec.new('Controller', nil)
|
40
|
+
assert_equal [s2, s1].sort, [s2, s1]
|
41
|
+
assert_equal [s1, s2].sort, [s2, s1]
|
42
|
+
|
43
|
+
s1 = NewRelic::MetricSpec.new('Controller')
|
44
|
+
s2 = NewRelic::MetricSpec.new('Controller')
|
45
|
+
assert_equal [s2, s1].sort, [s2, s1] # unchanged due to no sort criteria
|
46
|
+
assert_equal [s1, s2].sort, [s1, s2] # unchanged due to no sort criteria
|
47
|
+
|
48
|
+
s1 = NewRelic::MetricSpec.new('Controller', nil)
|
49
|
+
s2 = NewRelic::MetricSpec.new('Controller', nil)
|
50
|
+
assert_equal [s2, s1].sort, [s2, s1] # unchanged due to no sort criteria
|
51
|
+
assert_equal [s1, s2].sort, [s1, s2] # unchanged due to no sort criteria
|
52
|
+
end
|
53
|
+
|
54
|
+
def test_merge
|
55
|
+
s1 = NewRelic::MethodTraceStats.new
|
56
|
+
s2 = NewRelic::MethodTraceStats.new
|
57
|
+
|
58
|
+
s1.trace_call 10
|
59
|
+
s2.trace_call 20
|
60
|
+
s2.freeze
|
61
|
+
|
62
|
+
validate s2, 1, 20, 20, 20
|
63
|
+
s3 = s1.merge s2
|
64
|
+
validate s3, 2, (10+20), 10, 20
|
65
|
+
validate s1, 1, 10, 10, 10
|
66
|
+
validate s2, 1, 20, 20, 20
|
67
|
+
|
68
|
+
s1.merge! s2
|
69
|
+
validate s1, 2, (10+20), 10, 20
|
70
|
+
validate s2, 1, 20, 20, 20
|
71
|
+
end
|
72
|
+
|
73
|
+
def test_merge_with_exclusive
|
74
|
+
s1 = NewRelic::MethodTraceStats.new
|
75
|
+
|
76
|
+
s2 = NewRelic::MethodTraceStats.new
|
77
|
+
|
78
|
+
s1.trace_call 10, 5
|
79
|
+
s2.trace_call 20, 10
|
80
|
+
s2.freeze
|
81
|
+
|
82
|
+
validate s2, 1, 20, 20, 20, 10
|
83
|
+
s3 = s1.merge s2
|
84
|
+
validate s3, 2, (10+20), 10, 20, (10+5)
|
85
|
+
validate s1, 1, 10, 10, 10, 5
|
86
|
+
validate s2, 1, 20, 20, 20, 10
|
87
|
+
|
88
|
+
s1.merge! s2
|
89
|
+
validate s1, 2, (10+20), 10, 20, (5+10)
|
90
|
+
validate s2, 1, 20, 20, 20, 10
|
91
|
+
end
|
92
|
+
|
93
|
+
def test_merge_array
|
94
|
+
s1 = NewRelic::MethodTraceStats.new
|
95
|
+
merges = []
|
96
|
+
merges << (NewRelic::MethodTraceStats.new.trace_call 1)
|
97
|
+
merges << (NewRelic::MethodTraceStats.new.trace_call 1)
|
98
|
+
merges << (NewRelic::MethodTraceStats.new.trace_call 1)
|
99
|
+
|
100
|
+
s1.merge! merges
|
101
|
+
validate s1, 3, 3, 1, 1
|
102
|
+
end
|
103
|
+
|
104
|
+
def test_freeze
|
105
|
+
s1 = NewRelic::MethodTraceStats.new
|
106
|
+
|
107
|
+
s1.trace_call 10
|
108
|
+
s1.freeze
|
109
|
+
|
110
|
+
begin
|
111
|
+
# the following should throw an exception because s1 is frozen
|
112
|
+
s1.trace_call 20
|
113
|
+
assert false
|
114
|
+
rescue StandardError
|
115
|
+
assert s1.frozen?
|
116
|
+
validate s1, 1, 10, 10, 10
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
def test_std_dev
|
121
|
+
s = NewRelic::MethodTraceStats.new
|
122
|
+
|
123
|
+
s.trace_call 10
|
124
|
+
s.trace_call 10
|
125
|
+
s.trace_call 10
|
126
|
+
s.trace_call 10
|
127
|
+
s.trace_call 10
|
128
|
+
s.trace_call 10
|
129
|
+
assert s.standard_deviation == 0
|
130
|
+
|
131
|
+
s = NewRelic::MethodTraceStats.new
|
132
|
+
s.trace_call 4
|
133
|
+
s.trace_call 7
|
134
|
+
s.trace_call 13
|
135
|
+
s.trace_call 16
|
136
|
+
s.trace_call 8
|
137
|
+
s.trace_call 4
|
138
|
+
assert_equal(s.sum_of_squares, 4**2 + 7**2 + 13**2 + 16**2 + 8**2 + 4**2)
|
139
|
+
|
140
|
+
s.trace_call 9
|
141
|
+
s.trace_call 3
|
142
|
+
s.trace_call 1000
|
143
|
+
s.trace_call 4
|
144
|
+
|
145
|
+
# calculated stdev (population, not sample) from a spreadsheet.
|
146
|
+
assert_in_delta(s.standard_deviation, 297.76, 0.01)
|
147
|
+
end
|
148
|
+
|
149
|
+
def test_std_dev_merge
|
150
|
+
s1 = NewRelic::MethodTraceStats.new
|
151
|
+
s1.trace_call 4
|
152
|
+
s1.trace_call 7
|
153
|
+
|
154
|
+
s2 = NewRelic::MethodTraceStats.new
|
155
|
+
s2.trace_call 13
|
156
|
+
s2.trace_call 16
|
157
|
+
|
158
|
+
s3 = s1.merge(s2)
|
159
|
+
|
160
|
+
assert(s1.sum_of_squares, 4*4 + 7*7)
|
161
|
+
assert_in_delta(s1.standard_deviation, 1.5, 0.01)
|
162
|
+
|
163
|
+
assert_in_delta(s2.standard_deviation, 1.5, 0.01)
|
164
|
+
assert_equal(s3.sum_of_squares, 4*4 + 7*7 + 13*13 + 16*16, "check sum of squares")
|
165
|
+
assert_in_delta(s3.standard_deviation, 4.743, 0.01)
|
166
|
+
end
|
167
|
+
|
168
|
+
private
|
169
|
+
def validate (stats, count, total, min, max, exclusive = nil)
|
170
|
+
assert_equal stats.call_count, count
|
171
|
+
assert_equal stats.total_call_time, total
|
172
|
+
assert_equal stats.average_call_time, (count > 0 ? total / count : 0)
|
173
|
+
assert_equal stats.min_call_time, min
|
174
|
+
assert_equal stats.max_call_time, max
|
175
|
+
assert_equal stats.total_exclusive_time, exclusive if exclusive
|
176
|
+
end
|
177
|
+
end
|
@@ -0,0 +1,318 @@
|
|
1
|
+
# Run faster standalone
|
2
|
+
# ENV['SKIP_RAILS'] = 'true'
|
3
|
+
require File.expand_path(File.join(File.dirname(__FILE__),'..', '..', 'test_helper'))
|
4
|
+
require 'rack'
|
5
|
+
|
6
|
+
class EpisodesTest < Test::Unit::TestCase
|
7
|
+
|
8
|
+
def setup
|
9
|
+
super
|
10
|
+
|
11
|
+
@app = Mocha::Mockery.instance.named_mock 'Episodes'
|
12
|
+
#@app = mock('Episodes')
|
13
|
+
@e = NewRelic::Rack::Episodes.new(@app)
|
14
|
+
NewRelic::Agent.manual_start
|
15
|
+
@agent = NewRelic::Agent.instance
|
16
|
+
@agent.transaction_sampler.send :clear_builder
|
17
|
+
@agent.transaction_sampler.reset!
|
18
|
+
@agent.stats_engine.clear_stats
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_match
|
22
|
+
@e.expects(:process).times(3)
|
23
|
+
@app.expects(:call).times(2)
|
24
|
+
@e.call(mock_env('/newrelic/episodes/page_load/stuff'))
|
25
|
+
@e.call(mock_env('/newrelic/episodes/page_load'))
|
26
|
+
@e.call(mock_env('/newrelic/episodes/page_load?'))
|
27
|
+
|
28
|
+
@e.call(mock_env('/v2/newrelic/episodes/page_load?'))
|
29
|
+
@e.call(mock_env('/v2'))
|
30
|
+
end
|
31
|
+
|
32
|
+
def test_process
|
33
|
+
|
34
|
+
args = "ets=backend:2807,onload:7641,frontend:4835,pageready:7642,totaltime:7642&" +
|
35
|
+
"url=/bogosity/bogus_action&"+
|
36
|
+
"userAgent=#{Rack::Utils.escape("Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.2) Gecko/20100316 Firefox/3.6.2")}"
|
37
|
+
v = @e.call(mock_env("/newrelic/episodes/page_load?#{args}"))
|
38
|
+
assert_equal 3, v.size
|
39
|
+
assert_equal 204, v[0]
|
40
|
+
compare_metrics %w[
|
41
|
+
Apdex/Client/4.4
|
42
|
+
Apdex/Client/4.4/Mac/Firefox/3.6
|
43
|
+
Client/totaltime
|
44
|
+
Client/frontend
|
45
|
+
Client/backend
|
46
|
+
Client/onload
|
47
|
+
Client/pageready
|
48
|
+
Client/totaltime/Mac/Firefox/3.6
|
49
|
+
Client/frontend/Mac/Firefox/3.6
|
50
|
+
Client/backend/Mac/Firefox/3.6
|
51
|
+
Client/onload/Mac/Firefox/3.6
|
52
|
+
Client/pageready/Mac/Firefox/3.6], @agent.stats_engine.metrics
|
53
|
+
totaltime = @agent.stats_engine.get_stats_no_scope('Client/totaltime')
|
54
|
+
assert_equal 1, totaltime.call_count
|
55
|
+
assert_equal 7.642, totaltime.average_call_time
|
56
|
+
totaltime = @agent.stats_engine.get_stats_no_scope('Client/totaltime/Mac/Firefox/3.6')
|
57
|
+
assert_equal 1, totaltime.call_count
|
58
|
+
assert_equal 7.642, totaltime.average_call_time
|
59
|
+
end
|
60
|
+
|
61
|
+
context "when normalizing user agent strings" do
|
62
|
+
setup do
|
63
|
+
setup
|
64
|
+
@e.class.send :public, :identify_browser_and_os
|
65
|
+
end
|
66
|
+
|
67
|
+
should "parse 'like Firefox/* Gecko/*' as Gecko" do
|
68
|
+
browser, version, os = @e.identify_browser_and_os("Mozilla/5.0 (Macintosh; U; PPC; en-US; rv:1.0rc2) Gecko/20020512 like Firefox/3.1")
|
69
|
+
|
70
|
+
assert_equal "Mozilla Gecko", browser
|
71
|
+
assert_equal 1.0, version
|
72
|
+
end
|
73
|
+
|
74
|
+
should "parse 'Chrome/' as Chrome, unknown version" do
|
75
|
+
browser, version, os = @e.identify_browser_and_os("Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_6; en-US) AppleWebKit/530.5 (KHTML, like Gecko) Chrome/ Safari/530.5")
|
76
|
+
|
77
|
+
assert_equal "Chrome", browser
|
78
|
+
assert_equal 0, version
|
79
|
+
end
|
80
|
+
|
81
|
+
should "parse x.y float versions for Firefox, Gecko and Webkit" do
|
82
|
+
browser, version, os = @e.identify_browser_and_os("Mozilla/5.0 (Windows; U; Windows NT 6.0; ru; rv:1.9.2) Gecko/20100105 Firefox/3.6")
|
83
|
+
assert Float === version
|
84
|
+
|
85
|
+
browser, version, os = @e.identify_browser_and_os("Mozilla/5.0 (Macintosh; U; PPC; en-US; rv:1.0rc2) Gecko/20020512 Netscape/7.0b1")
|
86
|
+
assert Float === version
|
87
|
+
|
88
|
+
browser, version, os = @e.identify_browser_and_os("Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10_5_2; en-gb) AppleWebKit/526+ (KHTML, like Gecko) Version/3.1 iPhone")
|
89
|
+
assert Float === version
|
90
|
+
end
|
91
|
+
|
92
|
+
context "in-the-wild" do
|
93
|
+
should "identify AOL correctly" do
|
94
|
+
assert_equal ["IE", 5, "Windows"], @e.identify_browser_and_os("Mozilla/4.0 (compatible; MSIE 5.5; AOL 6.0; Windows 98)"), "AOL 6.0 identified incorrectly"
|
95
|
+
assert_equal ["IE", 6, "Windows"], @e.identify_browser_and_os("Mozilla/4.0 (compatible; MSIE 6.0; AOL 6.0; Windows NT 5.1)"), "AOL 6.0 identified incorrectly"
|
96
|
+
assert_equal ["IE", 6, "Windows"], @e.identify_browser_and_os("Mozilla/4.0 (compatible; MSIE 6.0; AOL 7.0; Windows 98; SpamBlockerUtility 4.8.0)"), "AOL 7.0 identified incorrectly"
|
97
|
+
assert_equal ["IE", 7, "Windows"], @e.identify_browser_and_os("Mozilla/4.0 (compatible; MSIE 7.0; AOL 7.0; Windows NT 5.1; .NET CLR 1.1.4322)"), "AOL 7.0 identified incorrectly"
|
98
|
+
assert_equal ["IE", 6, "Windows"], @e.identify_browser_and_os("Mozilla/4.0 (compatible; MSIE 6.0; AOL 8.0; Windows NT 5.1)"), "AOL 8.0 identified incorrectly"
|
99
|
+
assert_equal ["IE", 7, "Windows"], @e.identify_browser_and_os("Mozilla/4.0 (compatible; MSIE 7.0; AOL 8.0; Windows NT 5.1; GTB5; .NET CLR 1.1.4322; .NET CLR 2.0.50727)"), "AOL 8.0 identified incorrectly"
|
100
|
+
assert_equal ["IE", 8, "Windows"], @e.identify_browser_and_os("Mozilla/4.0 (compatible; MSIE 8.0; AOL 9.5; AOLBuild 4337.29; Windows NT 6.0; Trident/4.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.21022; .NET CLR 3.5.30729; .NET CLR 3.0.30618)"), "AOL 9.5 identified incorrectly"
|
101
|
+
end
|
102
|
+
|
103
|
+
should "identify Camino correctly" do
|
104
|
+
assert_equal ["Mozilla Gecko", 1.8, "Mac"], @e.identify_browser_and_os("Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.0.1) Gecko/20060214 Camino/1.0"), "Camino 1.0 identified incorrectly"
|
105
|
+
assert_equal ["Mozilla Gecko", 1.8, "Mac"], @e.identify_browser_and_os("Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.0.1) Gecko/20060119 Camino/1.0b2+"), "Camino 1.0b2+ identified incorrectly"
|
106
|
+
assert_equal ["Mozilla Gecko", 1.8, "Mac"], @e.identify_browser_and_os("Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en; rv:1.8.1.4) Gecko/20070509 Camino/1.5"), "Camino 1.5 identified incorrectly"
|
107
|
+
assert_equal ["Mozilla Gecko", 1.9, "Mac"], @e.identify_browser_and_os("Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en; rv:1.9.0.18) Gecko/2010021619 Camino/2.0.2 (like Firefox/3.0.18)"), "Camino 2.0.2 identified incorrectly"
|
108
|
+
assert_equal ["Mozilla Gecko", 1.9, "Mac"], @e.identify_browser_and_os("Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en; rv:1.9.0.10pre) Gecko/2009041800 Camino/2.0b3pre (like Firefox/3.0.10pre)"), "Camino 2.0b3pre identified incorrectly"
|
109
|
+
end
|
110
|
+
|
111
|
+
should "identify Chrome correctly" do
|
112
|
+
assert_equal ["Chrome", 0, "Mac"], @e.identify_browser_and_os("Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_6; en-US) AppleWebKit/530.5 (KHTML, like Gecko) Chrome/ Safari/530.5"), "Chrome identified incorrectly"
|
113
|
+
assert_equal ["Chrome", 1, "Windows"], @e.identify_browser_and_os("Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US) AppleWebKit/525.19 (KHTML, like Gecko) Chrome/1.0.154.59 Safari/525.19"), "Chrome 1.0.154.59 identified incorrectly"
|
114
|
+
assert_equal ["Chrome", 2, "Windows"], @e.identify_browser_and_os("Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/528.8 (KHTML, like Gecko) Chrome/2.0.156.0 Version/3.2.1 Safari/528.8"), "Chrome 2.0.156.0 identified incorrectly"
|
115
|
+
assert_equal ["Chrome", 2, "Linux"], @e.identify_browser_and_os("Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US) AppleWebKit/530.7 (KHTML, like Gecko) Chrome/2.0.175.0 Safari/530.7"), "Chrome 2.0.175.0 identified incorrectly"
|
116
|
+
assert_equal ["Chrome", 3, "Mac"], @e.identify_browser_and_os("Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_7; en-US) AppleWebKit/531.3 (KHTML, like Gecko) Chrome/3.0.192 Safari/531.3"), "Chrome 3.0.192 identified incorrectly"
|
117
|
+
assert_equal ["Chrome", 3, "Windows"], @e.identify_browser_and_os("Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/531.3 (KHTML, like Gecko) Chrome/3.0.193.0 Safari/531.3"), "Chrome 3.0.193.0 identified incorrectly"
|
118
|
+
assert_equal ["Chrome", 3, "Linux"], @e.identify_browser_and_os("Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/531.4 (KHTML, like Gecko) Chrome/3.0.194.0 Safari/531.4"), "Chrome 3.0.194.0 identified incorrectly"
|
119
|
+
assert_equal ["Chrome", 3, "Windows"], @e.identify_browser_and_os("Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/532.0 (KHTML,like Gecko) Chrome/3.0.195.27"), "Chrome 3.0.195.27 identified incorrectly"
|
120
|
+
assert_equal ["Chrome", 4, "Windows"], @e.identify_browser_and_os("Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/532.0 (KHTML, like Gecko) Chrome/4.0.201.1 Safari/532.0"), "Chrome 4.0.201.1 identified incorrectly"
|
121
|
+
assert_equal ["Chrome", 4, "Linux"], @e.identify_browser_and_os("Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/532.0 (KHTML, like Gecko) Chrome/4.0.202.0 Safari/532.0"), "Chrome 4.0.202.0 identified incorrectly"
|
122
|
+
assert_equal ["Chrome", 4, "Mac"], @e.identify_browser_and_os("Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_6; en-US) AppleWebKit/532.0 (KHTML, like Gecko) Chrome/4.0.202.0 Safari/532.0"), "Chrome 4.0.202.0 identified incorrectly"
|
123
|
+
assert_equal ["Chrome", 4, "Windows"], @e.identify_browser_and_os("Mozilla/5.0 (Windows; U; Windows NT 6.0 (x86_64); de-DE) AppleWebKit/532.0 (KHTML, like Gecko) Chrome/4.0.202.2 Safari/532.0"), "Chrome 4.0.202.2 identified incorrectly"
|
124
|
+
assert_equal ["Chrome", 5, "Windows"], @e.identify_browser_and_os("Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/532.9 (KHTML, like Gecko) Chrome/5.0.307.1 Safari/532.9"), "Chrome 5.0.307.1 identified incorrectly"
|
125
|
+
assert_equal ["Chrome", 5, "Mac"], @e.identify_browser_and_os("Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_0; en-US) AppleWebKit/532.9 (KHTML, like Gecko) Chrome/5.0.307.11 Safari/532.9"), "Chrome 5.0.307.11 identified incorrectly"
|
126
|
+
assert_equal ["Chrome", 5, "Linux"], @e.identify_browser_and_os("Mozilla/5.0 (X11; U; Linux x86_64; en-US) AppleWebKit/532.9 (KHTML, like Gecko) Chrome/5.0.309.0 Safari/532.9"), "Chrome 5.0.309.0 identified incorrectly"
|
127
|
+
assert_equal ["Chrome", 6, "Windows"], @e.identify_browser_and_os("Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/533.2 (KHTML, like Gecko) Chrome/6.0"), "Chrome 6.0 identified incorrectly"
|
128
|
+
end
|
129
|
+
|
130
|
+
should "identify Fennec correctly" do # Mozilla mobile browser
|
131
|
+
assert_equal ["Mozilla Gecko", 1.9, "Linux"], @e.identify_browser_and_os("Mozilla/5.0 (X11; U; Linux armv6l; en-US; rv:1.9.1a1pre) Gecko/2008071707 Fennec/0.5"), "Fennec 0.5 identified incorrectly"
|
132
|
+
assert_equal ["Mozilla Gecko", 1.9, "Linux"], @e.identify_browser_and_os("Mozilla/5.0 (X11; U; Linux armv6l; en-US; rv:1.9.1a2pre) Gecko/20080820121708 Fennec/0.7"), "Fennec 0.7 identified incorrectly"
|
133
|
+
assert_equal ["Mozilla Gecko", 1.9, "Linux"], @e.identify_browser_and_os("Mozilla/5.0 (X11; U; Linux armv6l; en-US; rv:1.9.1b1pre) Gecko/20080923171103 Fennec/0.8"), "Fennec 0.8 identified incorrectly"
|
134
|
+
assert_equal ["Mozilla Gecko", 1.9, "Linux"], @e.identify_browser_and_os("Mozilla/5.0 (X11; U; Linux armv6l; en-US; rv:1.9.1b1pre) Gecko/20081005220218 Gecko/2008052201 Fennec/0.9pre"), "Fennec 0.9pre identified incorrectly"
|
135
|
+
assert_equal ["Mozilla Gecko", 1.9, "Mac"], @e.identify_browser_and_os("Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.2a1pre) Gecko/20090626 Fennec/1.0b2"), "Fennec 1.0b2 identified incorrectly"
|
136
|
+
assert_equal ["Mozilla Gecko", 1.9, "Linux"], @e.identify_browser_and_os("Mozilla/5.0 (X11; U; Linux armv7l; en-US; rv:1.9.2a1pre) Gecko/20090322 Fennec/1.0b2pre"), "Fennec 1.0b2pre identified incorrectly"
|
137
|
+
assert_equal ["Mozilla Gecko", 1.8, "Windows"], @e.identify_browser_and_os("Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.8.1.17) Gecko/20080829 Mozilla/5.0 (X11; U; Linux armv7l; en-US; rv:1.9.2a1pre) Gecko/20090322 Fennec/1.0b2pre"), "Fennec 1.0b2pre identified incorrectly"
|
138
|
+
end
|
139
|
+
|
140
|
+
should "identify Firefox correctly" do
|
141
|
+
assert_equal ["Firefox", 1.0, "Windows"], @e.identify_browser_and_os("Mozilla/5.0 (Windows; U; Windows NT 5.2; de-DE; rv:1.7.6) Gecko/20050321 Firefox/1.0.2"), "Firefox 1.0.2 identified incorrectly"
|
142
|
+
assert_equal ["Firefox", 1.5, "Linux"], @e.identify_browser_and_os("Mozilla/5.0 (X11; U; Linux i686; lt-LT; rv:1.6) Gecko/20051114 Firefox/1.5"), "Firefox 1.5 identified incorrectly"
|
143
|
+
assert_equal ["Firefox", 1.5, "Windows"], @e.identify_browser_and_os("Mozilla/5.0 (Windows NT 5.2; U; de; rv:1.8.0) Gecko/20060728 Firefox/1.5.0"), "Firefox 1.5.0 identified incorrectly"
|
144
|
+
assert_equal ["Firefox", 1.5, "Linux"], @e.identify_browser_and_os("Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.8.0.9) Gecko/20070126 Ubuntu/dapper-security Firefox/1.5.0.9"), "Firefox 1.5.0.9 identified incorrectly"
|
145
|
+
assert_equal ["Firefox", 2.0, "Linux"], @e.identify_browser_and_os("Mozilla/5.0 (X11;U;Linux i686;en-US;rv:1.8.1) Gecko/2006101022 Firefox/2.0"), "Firefox 2.0 identified incorrectly"
|
146
|
+
assert_equal ["Firefox", 2.0, "Mac"], @e.identify_browser_and_os("Mozilla/5.0 (Macintosh; PPC Mac OS X; U; en; rv:1.8.1) Gecko/20061208 Firefox/2.0.0"), "Firefox 2.0.0 identified incorrectly"
|
147
|
+
assert_equal ["Firefox", 2.0, "Windows"], @e.identify_browser_and_os("Mozilla/5.0 (Windows NT 6.0; U; hu; rv:1.8.1) Gecko/20061208 Firefox/2.0.0"), "Firefox 2.0.0 identified incorrectly"
|
148
|
+
assert_equal ["Firefox", 2.0, "Windows"], @e.identify_browser_and_os("Mozilla/5.0 (Windows; U; Windows NT 5.2; en-GB; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13"), "Firefox 2.0.0.13 identified incorrectly"
|
149
|
+
assert_equal ["Firefox", 3.0, "Windows"], @e.identify_browser_and_os("Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.8) Gecko/2009032609 Firefox/3.0.0 (.NET CLR 3.5.30729)"), "Firefox 3.0.0 identified incorrectly"
|
150
|
+
assert_equal ["Firefox", 3.0, "Linux"], @e.identify_browser_and_os("Mozilla/5.0 (X11; U; Linux i686; tr-TR; rv:1.9.0.10) Gecko/2009042523 Ubuntu/9.04 (jaunty) Firefox/3.0.10"), "Firefox 3.0.10 identified incorrectly"
|
151
|
+
assert_equal ["Firefox", 3.5, "Windows"], @e.identify_browser_and_os("Mozilla/5.0 (Windows; U; Windows NT 6.0; ru; rv:1.9.1) Gecko/20090624 Firefox/3.5 (.NET CLR 3.5.30729)"), "Firefox 3.5 identified incorrectly"
|
152
|
+
assert_equal ["Firefox", 3.5, "Mac"], @e.identify_browser_and_os("Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; fr; rv:1.9.1b4) Gecko/20090423 Firefox/3.5b4"), "Firefox 3.5b4 identified incorrectly"
|
153
|
+
assert_equal ["Firefox", 3.6, "Windows"], @e.identify_browser_and_os("Mozilla/5.0 (Windows; U; Windows NT 6.0; ru; rv:1.9.2) Gecko/20100105 Firefox/3.6 (.NET CLR 3.5.30729)"), "Firefox 3.6 identified incorrectly"
|
154
|
+
assert_equal ["Firefox", 3.6, "Mac"], @e.identify_browser_and_os("Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.2) Gecko/20100316 Firefox/3.6.2"), "Firefox 3.6.2 identified incorrectly"
|
155
|
+
end
|
156
|
+
|
157
|
+
should "identify Flock correctly" do
|
158
|
+
assert_equal ["Firefox", 2.0, "Windows"], @e.identify_browser_and_os("Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.17) Gecko/20080910 Firefox/2.0.0.17 Flock/1.2.6"), "Flock 1.2.6 identified incorrectly"
|
159
|
+
assert_equal ["Firefox", 3.0, "Mac"], @e.identify_browser_and_os("Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.0.3) Gecko/2008100716 Firefox/3.0.3 Flock/2.0"), "Flock 2.0 identified incorrectly"
|
160
|
+
assert_equal ["Firefox", 3.0, "Windows"], @e.identify_browser_and_os("Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.3) Gecko/2008100719 Firefox/3.0.3 Flock/2.0"), "Flock 2.0 identified incorrectly"
|
161
|
+
assert_equal ["Safari", 0, "Windows"], @e.identify_browser_and_os("Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.7) Gecko/20091221 AppleWebKit/531.21.8 KHTML/4.3.2 (like Gecko) Firefox/3.5.7 Flock/2.5.6 (.NET CLR 3.5.30729)"), "Flock 2.5.6 identified incorrectly"
|
162
|
+
end
|
163
|
+
|
164
|
+
should "identify Fluid correctly" do # Safari-based single-site browser
|
165
|
+
assert_equal ["Safari", 0, "Mac"], @e.identify_browser_and_os("Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_1; nl-nl) AppleWebKit/532.3+ (KHTML, like Gecko) Fluid/0.9.6 Safari/532.3+"), "Fluid 0.9.6 identified incorrectly"
|
166
|
+
end
|
167
|
+
|
168
|
+
should "identify Iceweasel correctly" do # Debian's Firefox
|
169
|
+
assert_equal ["Firefox", 1.5, "Linux"], @e.identify_browser_and_os("Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.8pre) Gecko/20061001 Firefox/1.5.0.8pre (Iceweasel)"), "Iceweasel identified incorrectly"
|
170
|
+
assert_equal ["Firefox", 3.0, "Linux"], @e.identify_browser_and_os("Mozilla/5.0 (X11; U; Linux i686; en-GB; rv:1.9.0.7) Gecko/2009030814 Iceweasel Firefox/3.0.7 (Debian-3.0.7-1)"), "Iceweasel identified incorrectly"
|
171
|
+
assert_equal ["Firefox", 2.0, "Linux"], @e.identify_browser_and_os("Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0 Iceweasel/2.0.0.3 (Debian-2.0.0.13-1)"), "Iceweasel 2.0.0.3 identified incorrectly"
|
172
|
+
end
|
173
|
+
|
174
|
+
should "identify IE correctly" do
|
175
|
+
assert_equal ["IE", 3, "Windows"], @e.identify_browser_and_os("Mozilla/3.0 (compatible; MSIE 3.0; Windows NT 5.0)"), "Internet Explorer 3.0 identified incorrectly"
|
176
|
+
assert_equal ["IE", 4, "Windows"], @e.identify_browser_and_os("Mozilla/2.0 (compatible; MSIE 4.0; Windows 98)"), "Internet Explorer 4.0 identified incorrectly"
|
177
|
+
assert_equal ["IE", 4, "Windows"], @e.identify_browser_and_os("Mozilla/4.0 (compatible; MSIE 4.01; Windows CE)"), "Internet Explorer 4.01 identified incorrectly"
|
178
|
+
assert_equal ["IE", 4, "Unknown"], @e.identify_browser_and_os(" Mozilla/4.0 (compatible; MSIE 4.5; Mac_PowerPC)"), "Internet Explorer 4.5 identified incorrectly"
|
179
|
+
assert_equal ["IE", 4, "Unknown"], @e.identify_browser_and_os("Mozilla/4.0 (compatible; MSIE 4.5; Mac_PowerPC)"), "Internet Explorer 4.5 identified incorrectly"
|
180
|
+
assert_equal ["IE", 5, "Windows"], @e.identify_browser_and_os("Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt; .NET CLR 1.0.3705)"), "Internet Explorer 5.00 identified incorrectly"
|
181
|
+
assert_equal ["IE", 5, "Unknown"], @e.identify_browser_and_os(" Mozilla/4.0 (compatible; MSIE 5.2; Mac_PowerPC)"), "Internet Explorer 5.2 identified incorrectly"
|
182
|
+
assert_equal ["IE", 5, "Windows"], @e.identify_browser_and_os("Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.1; .NET CLR 2.0.50727)"), "Internet Explorer 5.50 identified incorrectly"
|
183
|
+
assert_equal ["IE", 6, "Windows"], @e.identify_browser_and_os("Mozilla/4.08 (compatible; MSIE 6.0; Windows NT 5.1)"), "Internet Explorer 6.0 identified incorrectly"
|
184
|
+
assert_equal ["IE", 6, "Windows"], @e.identify_browser_and_os("Mozilla/4.0 (Compatible; Windows NT 5.1; MSIE 6.0) (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)"), "Internet Explorer 6.0 identified incorrectly"
|
185
|
+
assert_equal ["IE", 6, "Windows"], @e.identify_browser_and_os("Mozilla/4.0 (compatible; MSIE 6.1; Windows XP)"), "Internet Explorer 6.1 identified incorrectly"
|
186
|
+
assert_equal ["IE", 7, "Windows"], @e.identify_browser_and_os("Mozilla/4.0 (Mozilla/4.0; MSIE 7.0; Windows NT 5.1; FDM; SV1; .NET CLR 3.0.04506.30)"), "Internet Explorer 7.0 identified incorrectly"
|
187
|
+
assert_equal ["IE", 7, "Windows"], @e.identify_browser_and_os("Mozilla/5.0 (compatible; MSIE 7.0; Windows NT 6.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; c .NET CLR 3.0.04506; .NET CLR 3.5.30707; InfoPath.1; el-GR)"), "Internet Explorer 7.0 identified incorrectly"
|
188
|
+
assert_equal ["IE", 8, "Windows"], @e.identify_browser_and_os("Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; GTB6.4; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; MSSDMC2.5.2219.1)"), "Internet Explorer 8.0 identified incorrectly"
|
189
|
+
assert_equal ["IE", 8, "Windows"], @e.identify_browser_and_os("Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; Media Center PC 6.0; InfoPath.2; MS-RTC LM 8)"), "Internet Explorer 8.0 identified incorrectly"
|
190
|
+
assert_equal ["IE", 8, "Windows"], @e.identify_browser_and_os("Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.2; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0)"), "Internet Explorer 8.0 identified incorrectly"
|
191
|
+
end
|
192
|
+
|
193
|
+
should "identify Mozilla correctly" do
|
194
|
+
assert_equal ["Mozilla Gecko", 1.4, "Linux"], @e.identify_browser_and_os("Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030908 Debian/1.4-4"), "Mozilla 1.4 identified incorrectly"
|
195
|
+
assert_equal ["Mozilla Gecko", 1.4, "Windows"], @e.identify_browser_and_os("Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624"), "Mozilla 1.4 identified incorrectly"
|
196
|
+
assert_equal ["Mozilla Gecko", 1.5, "Linux"], @e.identify_browser_and_os("Mozilla/5.0 (X11; U; Linux i686; de-AT; rv:1.5) Gecko/20031007"), "Mozilla 1.5 identified incorrectly"
|
197
|
+
assert_equal ["Mozilla Gecko", 1.5, "Windows"], @e.identify_browser_and_os("Mozilla/5.0 (Windows; U; Windows NT 5.0; de-AT; rv:1.5) Gecko/20031007"), "Mozilla 1.5 identified incorrectly"
|
198
|
+
assert_equal ["Mozilla Gecko", 1.6, "Linux"], @e.identify_browser_and_os("Mozilla/5.0 (X11; U; Linux x86_64; fr; rv:1.6) Gecko/20040115"), "Mozilla 1.6 identified incorrectly"
|
199
|
+
assert_equal ["Mozilla Gecko", 1.6, "Mac"], @e.identify_browser_and_os("Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.6) Gecko/20040113"), "Mozilla 1.6 identified incorrectly"
|
200
|
+
assert_equal ["Mozilla Gecko", 1.6, "Windows"], @e.identify_browser_and_os("Mozilla/5.0 (Windows; U; Windows NT 5.0; de-AT; rv:1.6) Gecko/20040113"), "Mozilla 1.6 identified incorrectly"
|
201
|
+
assert_equal ["Mozilla Gecko", 1.6, "Windows"], @e.identify_browser_and_os("Mozilla/5.0 (Windows; U; Windows NT 5.1; fr-FR; rv:1.6) Gecko/20040113"), "Mozilla 1.6 identified incorrectly"
|
202
|
+
|
203
|
+
# no way to tell that this string isn't Firefox, so let's lump it into Firefox
|
204
|
+
assert_equal ["Firefox", 0.9, "Windows"], @e.identify_browser_and_os("Mozilla/5.0 (Windows; U; Windows NT 5.1; es-ES; rv:1.7) Gecko/20040803 Firefox/0.9.3"), "Mozilla 1.7 identified incorrectly"
|
205
|
+
|
206
|
+
assert_equal ["Mozilla Gecko", 1.7, "Linux"], @e.identify_browser_and_os("Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7) Gecko/20040514"), "Mozilla 1.7 identified incorrectly"
|
207
|
+
assert_equal ["Mozilla Gecko", 1.7, "Windows"], @e.identify_browser_and_os("Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7) Gecko/20040616"), "Mozilla 1.7 identified incorrectly"
|
208
|
+
assert_equal ["Mozilla Gecko", 1.8, "Windows"], @e.identify_browser_and_os("Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.5) Gecko/20060719 KHTML/3.5.5"), "Mozilla 1.8.0.5 identified incorrectly"
|
209
|
+
assert_equal ["Mozilla Gecko", 1.8, "Mac"], @e.identify_browser_and_os("Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.11) Gecko/20071206"), "Mozilla 1.8.1.11 identified incorrectly"
|
210
|
+
assert_equal ["Mozilla Gecko", 1.8, "Linux"], @e.identify_browser_and_os("Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.13) Gecko/20080313"), "Mozilla 1.8.1.13 identified incorrectly"
|
211
|
+
assert_equal ["Mozilla Gecko", 1.9, "Windows"], @e.identify_browser_and_os("Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9.2a1pre) Gecko"), "Mozilla 1.9.2a1pre identified incorrectly"
|
212
|
+
|
213
|
+
assert_equal ["Mozilla Gecko", 0.9, "Linux"], @e.identify_browser_and_os(" Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.2) Gecko/20010726 Netscape6/6.1"), "Netscape 6.1 identified incorrectly"
|
214
|
+
assert_equal ["Mozilla Gecko", 0.9, "Mac"], @e.identify_browser_and_os(" Mozilla/5.0 (Macintosh; U; PPC; de-DE; rv:0.9.2) Gecko/20010726 Netscape6/6.1"), "Netscape 6.1 identified incorrectly"
|
215
|
+
assert_equal ["Mozilla Gecko", 0.9, "Windows"], @e.identify_browser_and_os("Mozilla/5.0 (Windows; U; Windows NT 5.1; fr-FR; rv:0.9.2) Gecko/20010726 Netscape6/6.1"), "Netscape 6.1 identified incorrectly"
|
216
|
+
assert_equal ["Mozilla Gecko", 1.0, "Windows"], @e.identify_browser_and_os("Mozilla/5.0 (Windows; U; Windows NT 5.0; ja-JP; rv:1.0.2) Gecko/20021120 Netscape/7.01"), "Netscape 7.01 identified incorrectly"
|
217
|
+
assert_equal ["Mozilla Gecko", 1.0, "Linux"], @e.identify_browser_and_os("Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0rc2) Gecko/20020513 Netscape/7.0b1"), "Netscape 7.0b1 identified incorrectly"
|
218
|
+
assert_equal ["Mozilla Gecko", 1.0, "Mac"], @e.identify_browser_and_os("Mozilla/5.0 (Macintosh; U; PPC; en-US; rv:1.0rc2) Gecko/20020512 Netscape/7.0b1"), "Netscape 7.0b1 identified incorrectly"
|
219
|
+
assert_equal ["Mozilla Gecko", 1.7, "Windows"], @e.identify_browser_and_os("Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20060111 Netscape/8.1"), "Netscape 8.1 identified incorrectly"
|
220
|
+
|
221
|
+
# no way to tell that these aren't Firefox
|
222
|
+
assert_equal ["Firefox", 2.0, "Linux"], @e.identify_browser_and_os("Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.8pre) Gecko/20071015 Firefox/2.0.0.7 Navigator/9.0"), "Netscape 9.0 identified incorrectly"
|
223
|
+
assert_equal ["Firefox", 2.0, "Mac"], @e.identify_browser_and_os("Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.1.8pre) Gecko/20071015 Firefox/2.0.0.7 Navigator/9.0"), "Netscape 9.0 identified incorrectly"
|
224
|
+
assert_equal ["Firefox", 2.0, "Windows"], @e.identify_browser_and_os("Mozilla/5.0 (Windows; U; Win 9x 4.90; en-US; rv:1.8.1.8pre) Gecko/20071015 Firefox/2.0.0.7 Navigator/9.0"), "Netscape 9.0 identified incorrectly"
|
225
|
+
end
|
226
|
+
|
227
|
+
should "identify OmniWeb correctly" do
|
228
|
+
assert_equal ["Safari", 0, "Mac"], @e.identify_browser_and_os("Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-US) AppleWebKit/125.4 (KHTML, like Gecko, Safari) OmniWeb/v563.59"), "OmniWeb v563.59 identified incorrectly"
|
229
|
+
end
|
230
|
+
|
231
|
+
should "identify Opera correctly" do
|
232
|
+
assert_equal ["Opera", 0, "Windows"], @e.identify_browser_and_os("Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; en) Opera"), "Opera identified incorrectly"
|
233
|
+
assert_equal ["Opera", 0, "Mac"], @e.identify_browser_and_os("Mozilla/5.0 (Macintosh; ; Intel Mac OS X; fr; rv:1.8.1.1) Gecko/20061204 Opera"), "Opera identified incorrectly"
|
234
|
+
assert_equal ["Opera", 7, "Windows"], @e.identify_browser_and_os("Mozilla/4.0 (compatible; MSIE 6.0; MSIE 5.5; Windows XP) Opera 7.0 [en]"), "Opera 7.0 identified incorrectly"
|
235
|
+
assert_equal ["Opera", 7, "Windows"], @e.identify_browser_and_os("Mozilla/4.78 (Windows NT 5.0; U) Opera 7.01 [en]"), "Opera 7.01 identified incorrectly"
|
236
|
+
assert_equal ["Opera", 7, "Windows"], @e.identify_browser_and_os("Mozilla/5.0 (Windows NT 5.0; U) Opera 7.01 [en]"), "Opera 7.01 identified incorrectly"
|
237
|
+
assert_equal ["Opera", 7, "Windows"], @e.identify_browser_and_os("Opera/7.52 (Windows NT 5.1; U) [en]"), "Opera 7.52 identified incorrectly"
|
238
|
+
assert_equal ["Opera", 7, "Linux"], @e.identify_browser_and_os("Opera/7.53 (X11; Linux i686; U) [en_US]"), "Opera 7.53 identified incorrectly"
|
239
|
+
assert_equal ["Opera", 8, "Linux"], @e.identify_browser_and_os("Opera/8.0 (X11; Linux i686; U; cs)"), "Opera 8.00 identified incorrectly"
|
240
|
+
assert_equal ["Opera", 8, "Windows"], @e.identify_browser_and_os("Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; ru) Opera 8.0"), "Opera 8.00 identified incorrectly"
|
241
|
+
assert_equal ["Opera", 9, "Mac"], @e.identify_browser_and_os("Opera/9.01 (Macintosh; PPC Mac OS X; U; en)"), "Opera 9.01 identified incorrectly"
|
242
|
+
assert_equal ["Opera", 9, "Linux"], @e.identify_browser_and_os("Opera/9.02 (X11; Linux i686; U; pl)"), "Opera 9.02 identified incorrectly"
|
243
|
+
assert_equal ["Opera", 9, "Windows"], @e.identify_browser_and_os("Opera/9.02 (Windows NT 5.0; U; de)"), "Opera 9.02 identified incorrectly"
|
244
|
+
assert_equal ["Opera", 9, "Linux"], @e.identify_browser_and_os("Opera/9.64 (X11; Linux x86_64; U; pl) Presto/2.1.1"), "Opera 9.64 identified incorrectly"
|
245
|
+
assert_equal ["Opera", 9, "Windows"], @e.identify_browser_and_os("Opera/9.64 (Windows NT 6.0; U; pl) Presto/2.1.1"), "Opera 9.64 identified incorrectly"
|
246
|
+
assert_equal ["Opera", 10, "Linux"], @e.identify_browser_and_os("Opera/9.80 (X11; Linux x86_64; U; en) Presto/2.2.15 Version/10.00"), "Opera 10.00 identified incorrectly"
|
247
|
+
assert_equal ["Opera", 10, "Windows"], @e.identify_browser_and_os("Opera/9.80 (Windows NT 5.1; U; ru) Presto/2.2.15 Version/10.00"), "Opera 10.00 identified incorrectly"
|
248
|
+
end
|
249
|
+
|
250
|
+
should "identify Safari correctly" do
|
251
|
+
assert_equal ["Safari", 0, "iPhone"], @e.identify_browser_and_os("Mozilla/5.0 (iPod; U; CPU iPhone OS 2_2_1 like Mac OS X; en-us) AppleWebKit/525.18.1 (KHTML, like Gecko) Mobile/5H11"), "Safari identified incorrectly"
|
252
|
+
assert_equal ["Safari", 0, "Mac"], @e.identify_browser_and_os("Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/125.2 (KHTML, like Gecko) Safari/125.7"), "Safari 1.2.2 identified incorrectly"
|
253
|
+
assert_equal ["Safari", 0, "Mac"], @e.identify_browser_and_os("Mozilla/5.0 (Macintosh; U; PPC Mac OS X; es) AppleWebKit/417.9 (KHTML, like Gecko) Safari/417.8"), "Safari 2.0.3 identified incorrectly"
|
254
|
+
assert_equal ["Safari", 3.0, "Windows"], @e.identify_browser_and_os("Mozilla/5.0 (Windows; U; Windows NT 5.1; nl) AppleWebKit/522.11.3 (KHTML, like Gecko) Version/3.0 Safari/522.11.3"), "Safari 3.0 identified incorrectly"
|
255
|
+
assert_equal ["Safari", 3.0, "Windows"], @e.identify_browser_and_os("Mozilla/5.0 (Windows; U; Windows NT 5.1; pl-PL) AppleWebKit/523.12.9 (KHTML, like Gecko) Version/3.0 Safari/523.12.9"), "Safari 3.0 identified incorrectly"
|
256
|
+
assert_equal ["Safari", 3.0, "Mac"], @e.identify_browser_and_os("Mozilla/5.0 (Macintosh; U; Intel Mac OS X; de-de) AppleWebKit/522.11.1 (KHTML, like Gecko) Version/3.0.3 Safari/522.12.1"), "Safari 3.0.3 identified incorrectly"
|
257
|
+
assert_equal ["Safari", 3.1, "Windows"], @e.identify_browser_and_os("Mozilla/5.0 (Windows; U; Windows NT 5.2; ru-RU) AppleWebKit/525.13 (KHTML, like Gecko) Version/3.1 Safari/525.13.3"), "Safari 3.1 identified incorrectly"
|
258
|
+
assert_equal ["Safari", 3.1, "iPhone"], @e.identify_browser_and_os("Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10_5_2; en-gb) AppleWebKit/526+ (KHTML, like Gecko) Version/3.1 iPhone"), "Safari 3.1 identified incorrectly"
|
259
|
+
assert_equal ["Safari", 3.1, "Mac"], @e.identify_browser_and_os("Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_2; fr-fr) AppleWebKit/525.18 (KHTML, like Gecko) Version/3.1.1 Safari/525.18"), "Safari 3.1.1 identified incorrectly"
|
260
|
+
assert_equal ["Safari", 4.0, "Windows"], @e.identify_browser_and_os("Mozilla/5.0 (Windows; U; Windows NT 6.0; ja-JP) AppleWebKit/528.16 (KHTML, like Gecko) Version/4.0 Safari/528.16"), "Safari 4.0 identified incorrectly"
|
261
|
+
assert_equal ["Safari", 4.0, "Mac"], @e.identify_browser_and_os("Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_7; en-us) AppleWebKit/530.19.2 (KHTML, like Gecko) Version/4.0.1 Safari/530.18"), "Safari 4.0.1 identified incorrectly"
|
262
|
+
assert_equal ["Safari", 4.0, "Mac"], @e.identify_browser_and_os("Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_3; en-us) AppleWebKit/531.22.7 (KHTML, like Gecko) Version/4.0.5 Safari/531.22.7"), "Safari 4.0.5 identified incorrectly"
|
263
|
+
assert_equal ["Safari", 4.0, "Windows"], @e.identify_browser_and_os("Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/531.22.7 (KHTML, like Gecko) Version/4.0.5 Safari/531.22.7"), "Safari 4.0.5 identified incorrectly"
|
264
|
+
end
|
265
|
+
|
266
|
+
should "identify SeaMonkey correctly" do # Mozilla distribution of core Gecko engine
|
267
|
+
assert_equal ["Mozilla Gecko", 1.8, "Linux"], @e.identify_browser_and_os("Mozilla/5.0 (X11; U; Linux i686; de-AT; rv:1.8.1.5) Gecko/20070716 SeaMonkey/1.1.3"), "SeaMonkey 1.1.3 identified incorrectly"
|
268
|
+
assert_equal ["Mozilla Gecko", 1.8, "Windows"], @e.identify_browser_and_os("Mozilla/5.0 (Windows; U; Windows NT 5.1; es-ES; rv:1.8.1.5) Gecko/20070716 SeaMonkey/1.1.3"), "SeaMonkey 1.1.3 identified incorrectly"
|
269
|
+
assert_equal ["Mozilla Gecko", 1.9, "Windows"], @e.identify_browser_and_os("Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1b3pre) Gecko/20081208 SeaMonkey/2.0"), "SeaMonkey 2.0 identified incorrectly"
|
270
|
+
assert_equal ["Mozilla Gecko", 1.9, "Linux"], @e.identify_browser_and_os("Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.9pre) Gecko/20100212 SeaMonkey/2.0.4pre"), "SeaMonkey 2.0.4pre identified incorrectly"
|
271
|
+
assert_equal ["Mozilla Gecko", 1.9, "Mac"], @e.identify_browser_and_os("Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.4; en-US; rv:1.9.1b3pre) Gecko/20090223 SeaMonkey/2.0a3"), "SeaMonkey 2.0a3 identified incorrectly"
|
272
|
+
end
|
273
|
+
end
|
274
|
+
end
|
275
|
+
|
276
|
+
private
|
277
|
+
|
278
|
+
def mock_env(uri_override)
|
279
|
+
path, query = uri_override.split('?')
|
280
|
+
|
281
|
+
Hash[
|
282
|
+
'HTTP_ACCEPT' => 'application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5',
|
283
|
+
'HTTP_ACCEPT_ENCODING' => 'gzip, deflate',
|
284
|
+
'HTTP_ACCEPT_LANGUAGE' => 'en-us',
|
285
|
+
'HTTP_CACHE_CONTROL' => 'max-age=0',
|
286
|
+
'HTTP_CONNECTION' => 'keep-alive',
|
287
|
+
'HTTP_COOKIE' => '_newrelic_development_session=BAh7CzoPc2Vzc2lvbl9pZCIlMTlkMGE5MTY1YmNhNTM5MjAxODRiNjdmNWY3ZTczOTU6D2FjY291bnRfaWRpBjoMdXNlcl9pZGkGOhNhcHBsaWNhdGlvbl9pZCIGMyIKZmxhc2hJQzonQWN0aW9uQ29udHJvbGxlcjo6Rmxhc2g6OkZsYXNoSGFzaHsABjoKQHVzZWR7ADoQdGltZV93aW5kb3dvOg9UaW1lV2luZG93CjoQQGJlZ2luX3RpbWVJdToJVGltZQ3OixuAAAAAGAY6H0BtYXJzaGFsX3dpdGhfdXRjX2NvZXJjaW9uRjoWQHJlcG9ydGluZ19wZXJpb2RpQToOQGVuZF90aW1lSXU7Dg3RixuAAAAAGAY7D0Y6DkBlbmRzX25vd1Q6D0ByYW5nZV9rZXk6EUxBU1RfM19IT1VSUw%3D%3D--ac863fb87fc0233caa5063398300a9b4c0c1fe71; _newrelic_local_production_session=BAh7CjoPc2Vzc2lvbl9pZCIlMjFmOGQzMmMwZmUxYjYzMjcyYjU1NzBkYmMyNzA5NTc6DHVzZXJfaWRpHjoTYXBwbGljYXRpb25faWQiCTE3NDY6D2FjY291bnRfaWRpPiIKZmxhc2hJQzonQWN0aW9uQ29udHJvbGxlcjo6Rmxhc2g6OkZsYXNoSGFzaHsABjoKQHVzZWR7AA%3D%3D--22ebf9e965e67d49430d8b9c2817302b37628766; auth_token=d0bf9b0468c3b994b23a0e1cdc712824ab4246d9',
|
288
|
+
'HTTP_HOST' => 'localhost:3000',
|
289
|
+
'HTTP_USER_AGENT' => 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_2; en-us) AppleWebKit/531.22.7 (KHTML, like Gecko) Version/4.0.5 Safari/531.22.7',
|
290
|
+
'HTTP_VERSION' => 'HTTP/1.1',
|
291
|
+
'QUERY_STRING' => query,
|
292
|
+
'REMOTE_ADDR' => '127.0.0.1',
|
293
|
+
'REQUEST_METHOD' => 'GET',
|
294
|
+
'PATH_INFO' => path,
|
295
|
+
'REQUEST_PATH' => path,
|
296
|
+
'REQUEST_URI' => uri_override,
|
297
|
+
'SCRIPT_NAME' => '',
|
298
|
+
'SERVER_NAME' => 'localhost',
|
299
|
+
'SERVER_PORT' => '3000',
|
300
|
+
'SERVER_PROTOCOL' => 'HTTP/1.1',
|
301
|
+
'SERVER_SOFTWARE' => 'Unicorn 0.97.0',
|
302
|
+
'rack.input' => StringIO.new,
|
303
|
+
'rack.errorst' => StringIO.new,
|
304
|
+
# 'rack.logger' => '#<Logger:0x1014d7cc0>',
|
305
|
+
# 'rack.session.options' => 'path/key_session_idexpire_afterdomainhttponlytrue',
|
306
|
+
'rack.multiprocess' => 'true',
|
307
|
+
'rack.multithread' => 'false',
|
308
|
+
'rack.run_once' => 'false',
|
309
|
+
'rack.session' => '',
|
310
|
+
'rack.url_scheme' => 'http',
|
311
|
+
'rack.version' => '11'
|
312
|
+
]
|
313
|
+
end
|
314
|
+
|
315
|
+
def mock_routes
|
316
|
+
ActionController::Routing::Routes.nil;
|
317
|
+
end
|
318
|
+
end if defined? NewRelic::Rack::Episodes
|