newrelic_rpm 3.1.0.beta1 → 3.1.0.beta2
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of newrelic_rpm might be problematic. Click here for more details.
- data/CHANGELOG +8 -2
- data/README.rdoc +28 -28
- data/bin/mongrel_rpm +1 -1
- data/lib/new_relic/agent.rb +24 -23
- data/lib/new_relic/agent/agent.rb +13 -11
- data/lib/new_relic/agent/beacon_configuration.rb +12 -8
- data/lib/new_relic/agent/browser_monitoring.rb +2 -2
- data/lib/new_relic/agent/error_collector.rb +1 -1
- data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +2 -2
- data/lib/new_relic/agent/instrumentation/data_mapper.rb +1 -1
- data/lib/new_relic/commands/deployments.rb +1 -1
- data/lib/new_relic/control/configuration.rb +1 -1
- data/lib/new_relic/delayed_job_injection.rb +5 -4
- data/lib/new_relic/histogram.rb +1 -1
- data/lib/new_relic/noticed_error.rb +1 -1
- data/lib/new_relic/rack/browser_monitoring.rb +7 -1
- data/lib/new_relic/rack/metric_app.rb +1 -0
- data/lib/new_relic/rack/mongrel_rpm.ru +2 -0
- data/lib/new_relic/recipes.rb +1 -1
- data/lib/new_relic/transaction_sample.rb +3 -2
- data/lib/new_relic/transaction_sample/segment.rb +4 -3
- data/lib/new_relic/version.rb +1 -1
- data/newrelic.yml +26 -26
- data/newrelic_rpm.gemspec +14 -19
- data/test/active_record_fixtures.rb +1 -1
- data/test/new_relic/agent/agent/connect_test.rb +6 -6
- data/test/new_relic/agent/agent/start_test.rb +1 -1
- data/test/new_relic/agent/agent/start_worker_thread_test.rb +1 -1
- data/test/new_relic/agent/agent_test.rb +43 -0
- data/test/new_relic/agent/beacon_configuration_test.rb +18 -35
- data/test/new_relic/agent/browser_monitoring_test.rb +17 -6
- data/test/new_relic/agent/error_collector/notice_error_test.rb +1 -1
- data/test/new_relic/rack/all_test.rb +11 -0
- data/ui/views/newrelic/_show_sample_sql.rhtml +1 -1
- data/ui/views/newrelic/index.rhtml +1 -1
- metadata +20 -25
- data/test/new_relic/rack/episodes_test.rb +0 -318
@@ -111,7 +111,7 @@ class NewRelic::Agent::Agent::StartTest < Test::Unit::TestCase
|
|
111
111
|
def test_log_sql_transmission_warning_positive
|
112
112
|
log = mocked_log
|
113
113
|
@record_sql = :raw
|
114
|
-
log.expects(:send).with(:warn, 'Agent is configured to send raw SQL to
|
114
|
+
log.expects(:send).with(:warn, 'Agent is configured to send raw SQL to the service')
|
115
115
|
log_sql_transmission_warning?
|
116
116
|
end
|
117
117
|
|
@@ -92,7 +92,7 @@ class NewRelic::Agent::Agent::StartWorkerThreadTest < Test::Unit::TestCase
|
|
92
92
|
error = mock('exception')
|
93
93
|
error.expects(:message).returns('a message')
|
94
94
|
log = mocked_log
|
95
|
-
log.expects(:error).with("
|
95
|
+
log.expects(:error).with("New Relic forced this agent to disconnect (a message)")
|
96
96
|
self.expects(:disconnect)
|
97
97
|
handle_force_disconnect(error)
|
98
98
|
end
|
@@ -37,6 +37,49 @@ module NewRelic
|
|
37
37
|
@agent.merge_data_from([{}])
|
38
38
|
end
|
39
39
|
|
40
|
+
def test_unsent_errors_size_empty
|
41
|
+
@agent.instance_eval {
|
42
|
+
@unsent_errors = nil
|
43
|
+
}
|
44
|
+
assert_equal(nil, @agent.unsent_errors_size)
|
45
|
+
end
|
46
|
+
|
47
|
+
def test_unsent_errors_size_with_errors
|
48
|
+
@agent.instance_eval {
|
49
|
+
@unsent_errors = ['an error']
|
50
|
+
}
|
51
|
+
assert_equal(1, @agent.unsent_errors_size)
|
52
|
+
end
|
53
|
+
|
54
|
+
def test_unsent_traces_size_empty
|
55
|
+
@agent.instance_eval {
|
56
|
+
@traces = nil
|
57
|
+
}
|
58
|
+
assert_equal(nil, @agent.unsent_traces_size)
|
59
|
+
end
|
60
|
+
|
61
|
+
def test_unsent_traces_size_with_traces
|
62
|
+
@agent.instance_eval {
|
63
|
+
@traces = ['a trace']
|
64
|
+
}
|
65
|
+
assert_equal(1, @agent.unsent_traces_size)
|
66
|
+
end
|
67
|
+
|
68
|
+
def test_unsent_timeslice_data_empty
|
69
|
+
@agent.instance_eval {
|
70
|
+
@unsent_timeslice_data = nil
|
71
|
+
}
|
72
|
+
assert_equal(0, @agent.unsent_timeslice_data, "should have zero timeslice data to start")
|
73
|
+
assert_equal({}, @agent.instance_variable_get('@unsent_timeslice_data'), "should initialize the timeslice data to an empty hash if it is empty")
|
74
|
+
end
|
75
|
+
|
76
|
+
def test_unsent_timeslice_data_with_errors
|
77
|
+
@agent.instance_eval {
|
78
|
+
@unsent_timeslice_data = {:key => 'value'}
|
79
|
+
}
|
80
|
+
assert_equal(1, @agent.unsent_timeslice_data, "should have the key from above")
|
81
|
+
end
|
82
|
+
|
40
83
|
def test_merge_data_from_all_three_empty
|
41
84
|
unsent_timeslice_data = mock('unsent timeslice data')
|
42
85
|
unsent_errors = mock('unsent errors')
|
@@ -19,7 +19,7 @@ class NewRelic::Agent::BeaconConfigurationTest < Test::Unit::TestCase
|
|
19
19
|
assert_equal 'a browser monitoring key', bc.browser_monitoring_key
|
20
20
|
assert_equal 'an application id', bc.application_id
|
21
21
|
assert_equal 'a beacon', bc.beacon
|
22
|
-
assert_equal
|
22
|
+
assert_equal 86, bc.browser_timing_header.size
|
23
23
|
end
|
24
24
|
|
25
25
|
def test_license_bytes_nil
|
@@ -50,38 +50,21 @@ class NewRelic::Agent::BeaconConfigurationTest < Test::Unit::TestCase
|
|
50
50
|
connect_data = {}
|
51
51
|
bc = NewRelic::Agent::BeaconConfiguration.new(connect_data)
|
52
52
|
bc.instance_eval { @rum_enabled = false }
|
53
|
-
assert_equal '', bc.build_browser_timing_header
|
53
|
+
assert_equal '', bc.build_browser_timing_header, "should not return a header when rum enabled is false"
|
54
54
|
end
|
55
55
|
|
56
56
|
def test_build_browser_timing_header_enabled_but_no_key
|
57
57
|
connect_data = {}
|
58
58
|
bc = NewRelic::Agent::BeaconConfiguration.new(connect_data)
|
59
59
|
bc.instance_eval { @rum_enabled = true; @browser_monitoring_key = nil }
|
60
|
-
assert_equal '', bc.build_browser_timing_header
|
60
|
+
assert_equal '', bc.build_browser_timing_header, "should not return a header when browser_monitoring_key is nil"
|
61
61
|
end
|
62
|
-
|
63
|
-
def test_build_browser_timing_header_enabled_checking_for_episodes_url
|
64
|
-
connect_data = {'episodes_url' => 'an episodes url'}
|
65
|
-
bc = NewRelic::Agent::BeaconConfiguration.new(connect_data)
|
66
|
-
bc.instance_eval { @rum_enabled = true; @browser_monitoring_key = 'a' * 40 }
|
67
|
-
assert(bc.build_browser_timing_header(connect_data).include?('an episodes url'), "should include the episodes url in the javascript")
|
68
|
-
end
|
69
|
-
|
62
|
+
|
70
63
|
def test_build_browser_timing_header_enabled_with_key
|
71
64
|
connect_data = {}
|
72
65
|
bc = NewRelic::Agent::BeaconConfiguration.new(connect_data)
|
73
66
|
bc.instance_eval { @browser_monitoring_key = 'a browser monitoring key' }
|
74
|
-
bc.
|
75
|
-
assert(bc.build_browser_timing_header(connect_data).include?('load file js'), "header should be generated when rum is enabled and browser monitoring key is set")
|
76
|
-
end
|
77
|
-
|
78
|
-
def test_basic_javascript
|
79
|
-
connect_data = {}
|
80
|
-
bc = NewRelic::Agent::BeaconConfiguration.new(connect_data)
|
81
|
-
mock_data = mock('connect data')
|
82
|
-
bc.expects(:load_file_js).with(mock_data)
|
83
|
-
# should just pass through the data
|
84
|
-
bc.basic_javascript(mock_data)
|
67
|
+
assert(bc.build_browser_timing_header.include?('NREUMQ'), "header should be generated when rum is enabled and browser monitoring key is set")
|
85
68
|
end
|
86
69
|
|
87
70
|
def test_build_browser_timing_header_should_html_safe_header
|
@@ -89,33 +72,33 @@ class NewRelic::Agent::BeaconConfigurationTest < Test::Unit::TestCase
|
|
89
72
|
connect_data = {'browser_key' => 'a' * 40}
|
90
73
|
bc = NewRelic::Agent::BeaconConfiguration.new(connect_data)
|
91
74
|
assert_equal('a' * 40, bc.instance_variable_get('@browser_monitoring_key'), "should save the key from the config")
|
92
|
-
bc.expects(:
|
75
|
+
bc.expects(:javascript_header).returns(mock_javascript)
|
93
76
|
mock_javascript.expects(:respond_to?).with(:html_safe).returns(true)
|
94
77
|
mock_javascript.expects(:html_safe)
|
95
|
-
bc.build_browser_timing_header
|
78
|
+
bc.build_browser_timing_header
|
96
79
|
end
|
97
|
-
|
98
|
-
def
|
80
|
+
|
81
|
+
def test_build_load_file_js_load_episodes_file_false
|
99
82
|
connect_data = {'rum.load_episodes_file' => false}
|
100
83
|
bc = NewRelic::Agent::BeaconConfiguration.new(connect_data)
|
101
|
-
assert_equal '', bc.
|
84
|
+
assert_equal '', bc.build_load_file_js(connect_data), "should be empty when load episodes file is false"
|
102
85
|
end
|
103
|
-
|
104
|
-
def
|
86
|
+
|
87
|
+
def test_build_load_file_js_load_episodes_file_missing
|
105
88
|
connect_data = {}
|
106
89
|
bc = NewRelic::Agent::BeaconConfiguration.new(connect_data)
|
107
|
-
assert_equal(
|
90
|
+
assert_equal(159, bc.build_load_file_js(connect_data).size, "should output the javascript when there is no configuration")
|
108
91
|
end
|
109
92
|
|
110
|
-
def
|
93
|
+
def test_build_load_file_js_load_episodes_file_present
|
111
94
|
connect_data = {'rum.load_episodes_file' => true}
|
112
95
|
bc = NewRelic::Agent::BeaconConfiguration.new(connect_data)
|
113
|
-
assert_equal(
|
96
|
+
assert_equal(159, bc.build_load_file_js(connect_data).size, "should output the javascript when rum.load_episodes_file is true")
|
114
97
|
end
|
115
|
-
|
116
|
-
def
|
98
|
+
|
99
|
+
def test_build_load_file_js_load_episodes_file_with_episodes_url
|
117
100
|
connect_data = {'episodes_url' => 'an episodes url'}
|
118
101
|
bc = NewRelic::Agent::BeaconConfiguration.new(connect_data)
|
119
|
-
assert(bc.
|
102
|
+
assert(bc.build_load_file_js(connect_data).include?('an episodes url'), "should include the episodes url by default")
|
120
103
|
end
|
121
104
|
end
|
@@ -30,13 +30,13 @@ class NewRelic::Agent::BrowserMonitoringTest < Test::Unit::TestCase
|
|
30
30
|
|
31
31
|
def test_browser_timing_header
|
32
32
|
header = browser_timing_header
|
33
|
-
assert_equal "<script>var NREUMQ=[];NREUMQ.push([\"mark\",\"firstbyte\",new Date().getTime()])
|
33
|
+
assert_equal "<script>var NREUMQ=[];NREUMQ.push([\"mark\",\"firstbyte\",new Date().getTime()]);</script>", header
|
34
34
|
end
|
35
35
|
|
36
36
|
def test_browser_timing_header_with_rum_enabled_not_specified
|
37
37
|
NewRelic::Agent.instance.expects(:beacon_configuration).at_least_once.returns( NewRelic::Agent::BeaconConfiguration.new({"browser_key" => "browserKey", "application_id" => "apId", "beacon"=>"beacon", "episodes_url"=>"this_is_my_file"}))
|
38
38
|
header = browser_timing_header
|
39
|
-
assert_equal "<script>var NREUMQ=[];NREUMQ.push([\"mark\",\"firstbyte\",new Date().getTime()])
|
39
|
+
assert_equal "<script>var NREUMQ=[];NREUMQ.push([\"mark\",\"firstbyte\",new Date().getTime()]);</script>", header
|
40
40
|
end
|
41
41
|
|
42
42
|
def test_browser_timing_header_with_rum_enabled_false
|
@@ -68,7 +68,8 @@ class NewRelic::Agent::BrowserMonitoringTest < Test::Unit::TestCase
|
|
68
68
|
Thread.current[:newrelic_start_time] = Time.now
|
69
69
|
|
70
70
|
footer = browser_timing_footer
|
71
|
-
|
71
|
+
snippet = "<script>(function(){var d=document;var e=d.createElement(\"script\");e.async=true;e.src=\"this_is_my_file\";var s=d.getElementsByTagName(\"script\")[0];s.parentNode.insertBefore(e,s);})();NREUMQ.push([\"nrf2\","
|
72
|
+
assert footer.include?(snippet), "Expected footer to include snippet: #{snippet}, but instead was #{footer}"
|
72
73
|
end
|
73
74
|
|
74
75
|
def test_browser_timing_footer_without_calling_header
|
@@ -100,8 +101,10 @@ class NewRelic::Agent::BrowserMonitoringTest < Test::Unit::TestCase
|
|
100
101
|
config.expects(:license_bytes).returns(license_bytes)
|
101
102
|
NewRelic::Agent.instance.expects(:beacon_configuration).returns(config).at_least_once
|
102
103
|
footer = browser_timing_footer
|
103
|
-
|
104
|
-
|
104
|
+
beginning_snippet = "(function(){var d=document;var e=d.createElement(\"script\");e.async=true;e.src=\"this_is_my_file\";var s=d.getElementsByTagName(\"script\")[0];s.parentNode.insertBefore(e,s);})();NREUMQ.push([\"nrf2\","
|
105
|
+
ending_snippet = "])</script>"
|
106
|
+
assert(footer.include?(beginning_snippet), "expected footer to include beginning snippet: #{beginning_snippet}, but was #{footer}")
|
107
|
+
assert(footer.include?(ending_snippet), "expected footer to include ending snippet: #{ending_snippet}, but was #{footer}")
|
105
108
|
end
|
106
109
|
|
107
110
|
def test_browser_timing_footer_with_no_beacon_configuration
|
@@ -231,7 +234,7 @@ class NewRelic::Agent::BrowserMonitoringTest < Test::Unit::TestCase
|
|
231
234
|
self.expects(:obfuscate).with('most recent transaction').returns('most recent transaction')
|
232
235
|
|
233
236
|
value = footer_js_string(beacon, license_key, application_id)
|
234
|
-
assert_equal('<script
|
237
|
+
assert_equal('<script>(function(){var d=document;var e=d.createElement("script");e.async=true;e.src="this_is_my_file";var s=d.getElementsByTagName("script")[0];s.parentNode.insertBefore(e,s);})();NREUMQ.push(["nrf2","","",1,"most recent transaction",0,0,new Date().getTime()])</script>', value, "should return the javascript given some default values")
|
235
238
|
end
|
236
239
|
|
237
240
|
def test_html_safe_if_needed_unsafed
|
@@ -260,4 +263,12 @@ class NewRelic::Agent::BrowserMonitoringTest < Test::Unit::TestCase
|
|
260
263
|
output = obfuscate(text)
|
261
264
|
assert_equal('YCJrZXV2fih5Y25vaCFtZSR2a2ZkZSp/aXV1', output, "should output obfuscated text")
|
262
265
|
end
|
266
|
+
|
267
|
+
def test_obfuscate_long_string
|
268
|
+
text = 'a happy piece of small text' * 5
|
269
|
+
key = (1..40).to_a
|
270
|
+
NewRelic::Agent.instance.beacon_configuration.expects(:license_bytes).returns(key)
|
271
|
+
output = obfuscate(text)
|
272
|
+
assert_equal('YCJrZXV2fih5Y25vaCFtZSR2a2ZkZSp/aXV1YyNsZHZ3cSl6YmluZCJsYiV1amllZit4aHl2YiRtZ3d4cCp7ZWhiZyNrYyZ0ZWhmZyx5ZHp3ZSVuZnh5cyt8ZGRhZiRqYCd7ZGtnYC11Z3twZCZvaXl6cix9aGdgYSVpYSh6Z2pgYSF2Znxx', output, "should output obfuscated text")
|
273
|
+
end
|
263
274
|
end
|
@@ -124,7 +124,7 @@ class NewRelic::Agent::ErrorCollector::NoticeErrorTest < Test::Unit::TestCase
|
|
124
124
|
@errors = %w(1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21)
|
125
125
|
fake_log = mock('log')
|
126
126
|
self.expects(:log).returns(fake_log)
|
127
|
-
fake_log.expects(:warn).with('The error reporting queue has reached 20. The error detail for this and subsequent errors will not be transmitted to
|
127
|
+
fake_log.expects(:warn).with('The error reporting queue has reached 20. The error detail for this and subsequent errors will not be transmitted to New Relic until the queued errors have been sent: hooray')
|
128
128
|
assert over_queue_limit?('hooray')
|
129
129
|
end
|
130
130
|
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__),'..','..','test_helper'))
|
2
|
+
require 'new_relic/rack/browser_monitoring'
|
3
|
+
require 'new_relic/rack/developer_mode'
|
4
|
+
class NewRelic::Rack::AllTest < Test::Unit::TestCase
|
5
|
+
# just here to load the files above
|
6
|
+
|
7
|
+
def test_truth
|
8
|
+
assert true
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<% if rows_logger_present? %>
|
2
2
|
<h3>Plugin Incompatibility</h3>
|
3
3
|
The Rows Logger plugin rewrites part of Active Record, which in effect turns off the
|
4
|
-
SQL statement tracing functionality of NewRelic
|
4
|
+
SQL statement tracing functionality of NewRelic Developer Mode. To gain SQL statement
|
5
5
|
visibility, you must remove <samp>rows_logger_plugin</samp>, or change your plugin load order
|
6
6
|
so that the rows logger is loaded first.
|
7
7
|
<% else %>
|
@@ -49,7 +49,7 @@
|
|
49
49
|
<% end %>
|
50
50
|
<h3>Welcome</h3>
|
51
51
|
<p>
|
52
|
-
Welcome to <b>New Relic
|
52
|
+
Welcome to <b>New Relic Developer Mode</b>. This Rails extension traces the performance activity
|
53
53
|
of your 100 most recent controller actions in your rails application, and presents the performance
|
54
54
|
information for your analysis.
|
55
55
|
</p>
|
metadata
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: newrelic_rpm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: -1848230030
|
5
|
+
prerelease: true
|
6
6
|
segments:
|
7
7
|
- 3
|
8
8
|
- 1
|
9
9
|
- 0
|
10
|
-
-
|
11
|
-
|
12
|
-
version: 3.1.0.beta1
|
10
|
+
- beta2
|
11
|
+
version: 3.1.0.beta2
|
13
12
|
platform: ruby
|
14
13
|
authors:
|
15
14
|
- Bill Kayser
|
@@ -18,7 +17,7 @@ autorequire:
|
|
18
17
|
bindir: bin
|
19
18
|
cert_chain: []
|
20
19
|
|
21
|
-
date: 2011-05-
|
20
|
+
date: 2011-05-20 00:00:00 -07:00
|
22
21
|
default_executable:
|
23
22
|
dependencies:
|
24
23
|
- !ruby/object:Gem::Dependency
|
@@ -64,12 +63,12 @@ dependencies:
|
|
64
63
|
type: :development
|
65
64
|
version_requirements: *id003
|
66
65
|
description: |
|
67
|
-
New Relic
|
68
|
-
|
69
|
-
information about the performance of your
|
70
|
-
|
71
|
-
|
72
|
-
http://github.com/newrelic/rpm/
|
66
|
+
New Relic is a performance management system, developed by New Relic,
|
67
|
+
Inc (http://www.newrelic.com). New Relic provides you with deep
|
68
|
+
information about the performance of your web application as it runs
|
69
|
+
in production. The New Relic Ruby Agent is dual-purposed as a either a
|
70
|
+
Gem or plugin, hosted on
|
71
|
+
http://github.com/newrelic/rpm/
|
73
72
|
|
74
73
|
email: support@newrelic.com
|
75
74
|
executables:
|
@@ -243,7 +242,7 @@ files:
|
|
243
242
|
- test/new_relic/local_environment_test.rb
|
244
243
|
- test/new_relic/metric_data_test.rb
|
245
244
|
- test/new_relic/metric_spec_test.rb
|
246
|
-
- test/new_relic/rack/
|
245
|
+
- test/new_relic/rack/all_test.rb
|
247
246
|
- test/new_relic/stats_test.rb
|
248
247
|
- test/new_relic/transaction_analysis/segment_summary_test.rb
|
249
248
|
- test/new_relic/transaction_analysis_test.rb
|
@@ -340,13 +339,13 @@ has_rdoc: true
|
|
340
339
|
homepage: http://www.github.com/newrelic/rpm
|
341
340
|
licenses: []
|
342
341
|
|
343
|
-
post_install_message:
|
342
|
+
post_install_message: |
|
344
343
|
|
345
344
|
PLEASE NOTE:
|
346
345
|
|
347
346
|
Developer Mode is now a Rack middleware.
|
348
347
|
|
349
|
-
|
348
|
+
Developer Mode is no longer available in Rails 2.1 and earlier.
|
350
349
|
However, starting in version 2.12 you can use Developer Mode in any
|
351
350
|
Rack based framework, in addition to Rails. To install developer mode
|
352
351
|
in a non-Rails application, just add NewRelic::Rack::DeveloperMode to
|
@@ -357,20 +356,16 @@ post_install_message: |+
|
|
357
356
|
|
358
357
|
Refer to the README.md file for more information.
|
359
358
|
|
360
|
-
Please see http://
|
359
|
+
Please see http://github.com/newrelic/rpm/blob/master/CHANGELOG
|
361
360
|
for a complete description of the features and enhancements available
|
362
361
|
in version 3.1 of the Ruby Agent.
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
Notice: Developer Mode now supports only Rails 2.3+ - refer to README
|
367
|
-
for instructions for previous versions
|
368
|
-
|
362
|
+
|
363
|
+
|
369
364
|
rdoc_options:
|
370
365
|
- --line-numbers
|
371
366
|
- --inline-source
|
372
367
|
- --title
|
373
|
-
- New Relic Ruby
|
368
|
+
- New Relic Ruby Agent
|
374
369
|
require_paths:
|
375
370
|
- lib
|
376
371
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -394,9 +389,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
394
389
|
requirements: []
|
395
390
|
|
396
391
|
rubyforge_project:
|
397
|
-
rubygems_version: 1.
|
392
|
+
rubygems_version: 1.3.7
|
398
393
|
signing_key:
|
399
394
|
specification_version: 3
|
400
|
-
summary: New Relic Ruby
|
395
|
+
summary: New Relic Ruby Agent
|
401
396
|
test_files: []
|
402
397
|
|
@@ -1,318 +0,0 @@
|
|
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
|