rack-insight 0.5.27 → 0.5.28
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +32 -0
- data/README.md +32 -7
- data/lib/rack/insight/app.rb +5 -0
- data/lib/rack/insight/config.rb +6 -2
- data/lib/rack/insight/enable-button.rb +3 -4
- data/lib/rack/insight/panels/request_variables_panel.rb +4 -1
- data/lib/rack/insight/public/__insight__/insight.js +134 -128
- data/lib/rack/insight/toolbar.rb +9 -6
- data/lib/rack/insight/version.rb +1 -1
- data/lib/rack/insight/views/toolbar.html.erb +11 -9
- metadata +69 -105
- checksums.yaml +0 -7
- data/.gitignore +0 -13
- data/.rspec +0 -1
- data/.ruby-gemset +0 -1
- data/.ruby-version +0 -1
- data/.simplecov +0 -4
- data/.travis.yml +0 -10
- data/Gemfile +0 -3
- data/Gemfile.lock +0 -69
- data/TODO +0 -9
- data/rack-insight.gemspec +0 -42
- data/spec/custom_matchers.rb +0 -0
- data/spec/fixtures/config.ru +0 -8
- data/spec/fixtures/dummy_panel.rb +0 -2
- data/spec/fixtures/sample_app.rb +0 -72
- data/spec/fixtures/star_trek_panel.rb +0 -6
- data/spec/fixtures/views/star_trek.html.erb +0 -17
- data/spec/insight_spec.rb +0 -166
- data/spec/instrumentation_spec.rb +0 -231
- data/spec/rack/insight/config_spec.rb +0 -22
- data/spec/rack/insight/panels/active_record_panel_spec.rb +0 -44
- data/spec/rack/insight/panels/active_resource_panel_spec.rb +0 -40
- data/spec/rack/insight/panels/cache_panel_spec.rb +0 -179
- data/spec/rack/insight/panels/log_panel_spec.rb +0 -43
- data/spec/rack/insight/panels/memory_panel_spec.rb +0 -21
- data/spec/rack/insight/panels/mongo_panel_spec_pending.rb +0 -52
- data/spec/rack/insight/panels/rails_info_panel_spec.rb +0 -30
- data/spec/rack/insight/panels/redis_panel_spec.rb +0 -82
- data/spec/rack/insight/panels/speedtracer_panel_spec.rb +0 -87
- data/spec/rack/insight/panels/sql_panel_spec.rb +0 -150
- data/spec/rack/insight/panels/templates_panel_spec.rb +0 -88
- data/spec/rack/insight/panels/timer_panel_spec.rb +0 -39
- data/spec/rcov.opts +0 -1
- data/spec/spec.opts +0 -1
- data/spec/spec_helper.rb +0 -120
@@ -1,231 +0,0 @@
|
|
1
|
-
require 'rack/insight/instrumentation'
|
2
|
-
require 'rack/insight/instrumentation/setup'
|
3
|
-
|
4
|
-
class One
|
5
|
-
def initialize(arry)
|
6
|
-
@array = arry
|
7
|
-
end
|
8
|
-
|
9
|
-
def self.record_self(array)
|
10
|
-
array << self
|
11
|
-
end
|
12
|
-
|
13
|
-
def self.a_class_method(array)
|
14
|
-
yield(array)
|
15
|
-
end
|
16
|
-
|
17
|
-
def an_instance_method()
|
18
|
-
yield(@array)
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
module Mod
|
23
|
-
def module_method(array)
|
24
|
-
yield(array)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
class Two < One
|
29
|
-
def an_instance_method
|
30
|
-
super
|
31
|
-
end
|
32
|
-
|
33
|
-
def self.a_class_method(array)
|
34
|
-
super
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
class Probeable
|
39
|
-
include Rack::Insight::Instrumentation::Client
|
40
|
-
class << self
|
41
|
-
include Rack::Insight::Instrumentation::EigenClient
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
module MyEigenClient;
|
46
|
-
def self.included(base)
|
47
|
-
base.send(:attr_accessor, :is_probed)
|
48
|
-
end
|
49
|
-
end
|
50
|
-
module MyClient; def probe; "anal probe is #{self.class.is_probed}"; end; end
|
51
|
-
class MyPanel; include MyClient; class << self; include MyEigenClient; end; end
|
52
|
-
class MyPanel2; include MyClient; class << self; include MyEigenClient; end; end
|
53
|
-
|
54
|
-
describe "Validate Client Design" do
|
55
|
-
it "MyPanel instance should respond to probe" do
|
56
|
-
MyPanel.new.respond_to?(:probe).should be_true
|
57
|
-
end
|
58
|
-
it "MyPanel#probe should return 'anal_probe is '" do
|
59
|
-
MyPanel.new.probe.should == 'anal probe is '
|
60
|
-
end
|
61
|
-
it "MyPanel class should respond to is_probed" do
|
62
|
-
MyPanel.respond_to?(:is_probed).should be_true
|
63
|
-
end
|
64
|
-
it "MyPanel.is_probed should default to nil" do
|
65
|
-
MyPanel.is_probed.should == nil
|
66
|
-
end
|
67
|
-
it "MyPanel.is_probed should be settable" do
|
68
|
-
MyPanel.is_probed = 'fat mojo'
|
69
|
-
MyPanel.is_probed.should == 'fat mojo'
|
70
|
-
MyPanel.new.probe.should == 'anal probe is fat mojo'
|
71
|
-
end
|
72
|
-
it "MyPanel2.is_probed should not interfere with MyPanel.is_probed" do
|
73
|
-
MyPanel.is_probed = 'fat mojo'
|
74
|
-
MyPanel2.is_probed = 'nice banana'
|
75
|
-
MyPanel.is_probed.should == 'fat mojo'
|
76
|
-
MyPanel2.is_probed.should == 'nice banana'
|
77
|
-
MyPanel.new.probe.should == 'anal probe is fat mojo'
|
78
|
-
MyPanel2.new.probe.should == 'anal probe is nice banana'
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
describe "Setting up probes" do
|
83
|
-
let :method_calls do [] end
|
84
|
-
let :method_subject do [] end
|
85
|
-
let :recording_list do [] end
|
86
|
-
|
87
|
-
let :test_collector do
|
88
|
-
collector = Probeable.new
|
89
|
-
collector.instance_variable_set("@calls", method_calls)
|
90
|
-
def collector.after_detect(method_call, timing, arguments, results)
|
91
|
-
@calls << [method_call, timing, arguments, results]
|
92
|
-
end
|
93
|
-
collector
|
94
|
-
end
|
95
|
-
|
96
|
-
let :instrument_setup do
|
97
|
-
Rack::Insight::Instrumentation::Setup.new(nil)
|
98
|
-
end
|
99
|
-
|
100
|
-
let :fake_env do
|
101
|
-
{}
|
102
|
-
end
|
103
|
-
|
104
|
-
before :each do
|
105
|
-
test_collector.probe(test_collector) do
|
106
|
-
instrument "One" do
|
107
|
-
instance_probe :an_instance_method
|
108
|
-
class_probe :a_class_method
|
109
|
-
class_probe :record_self
|
110
|
-
class_probe :allocate
|
111
|
-
end
|
112
|
-
end
|
113
|
-
instrument_setup.setup(fake_env)
|
114
|
-
end
|
115
|
-
|
116
|
-
after :each do
|
117
|
-
instrument_setup.teardown(fake_env, 200, {}, "")
|
118
|
-
end
|
119
|
-
|
120
|
-
# Test cases:
|
121
|
-
#
|
122
|
-
# Methods are called on
|
123
|
-
# instance
|
124
|
-
# class
|
125
|
-
# modules
|
126
|
-
#
|
127
|
-
# Methods are defined/probed at/called on
|
128
|
-
# Called on:
|
129
|
-
# obj: instance of class C
|
130
|
-
#
|
131
|
-
# Defined:
|
132
|
-
# class C
|
133
|
-
# super class B
|
134
|
-
# class C and parent B (overridden)
|
135
|
-
# module Mc - included in C
|
136
|
-
# class C and Mc
|
137
|
-
# module Mb - included in B
|
138
|
-
# class C and Mb
|
139
|
-
# module Me - extended in obj
|
140
|
-
# Me and C - Me overrides C
|
141
|
-
#
|
142
|
-
# Probed:
|
143
|
-
# On C
|
144
|
-
# On B
|
145
|
-
# On Mc, Mb, Me
|
146
|
-
#
|
147
|
-
# Not interfere with:
|
148
|
-
# Arguments
|
149
|
-
# Blocks
|
150
|
-
# Return Values
|
151
|
-
# Exceptions
|
152
|
-
#
|
153
|
-
|
154
|
-
it "should catch class methods defined on a superclass" do
|
155
|
-
#expect do
|
156
|
-
One.allocate
|
157
|
-
#end.to change(method_calls.length).by(1)
|
158
|
-
method_calls.last[0].method.should == :allocate
|
159
|
-
end
|
160
|
-
|
161
|
-
it "should not interfere with instance method call on One" do
|
162
|
-
expect do
|
163
|
-
One.new(method_subject).an_instance_method{|arr| arr << __LINE__}
|
164
|
-
end.to change{method_subject.length}.by(1)
|
165
|
-
end
|
166
|
-
|
167
|
-
it "should not interfere with class method call" do
|
168
|
-
expect do
|
169
|
-
One.a_class_method(method_subject){|arr| arr << __LINE__}
|
170
|
-
end.to change{method_subject.length}.by(1)
|
171
|
-
end
|
172
|
-
|
173
|
-
it "should collect calls made on One#an_instance_method" do
|
174
|
-
expect do
|
175
|
-
One.new(method_subject).an_instance_method{|arr| arr << __LINE__}
|
176
|
-
end.to change{method_calls.length}.by(1)
|
177
|
-
method_calls.last[0].method.should == :an_instance_method
|
178
|
-
end
|
179
|
-
|
180
|
-
it "should collect calls made on One#a_class_method" do
|
181
|
-
expect do
|
182
|
-
One.a_class_method(method_subject){|arr| arr << __LINE__}
|
183
|
-
end.to change{method_calls.length}.by(1)
|
184
|
-
method_calls.last[0].method.should == :a_class_method
|
185
|
-
end
|
186
|
-
|
187
|
-
it "should not mess with receive of class methods" do
|
188
|
-
One.record_self(recording_list)
|
189
|
-
recording_list.should include(One)
|
190
|
-
end
|
191
|
-
|
192
|
-
it "should not mess with receive of class methods on subclasses" do
|
193
|
-
Two.record_self(recording_list)
|
194
|
-
recording_list.should include(Two)
|
195
|
-
end
|
196
|
-
|
197
|
-
|
198
|
-
it "should not interfere with instance method call on Two" do
|
199
|
-
expect do
|
200
|
-
Two.new(method_subject).an_instance_method{|arr| arr << __LINE__}
|
201
|
-
end.to change{method_subject.length}.by(1)
|
202
|
-
end
|
203
|
-
|
204
|
-
it "should not interfere with class method call" do
|
205
|
-
expect do
|
206
|
-
Two.a_class_method(method_subject){|arr| arr << __LINE__}
|
207
|
-
end.to change{method_subject.length}.by(1)
|
208
|
-
end
|
209
|
-
|
210
|
-
it "should collect calls made on Two#an_instance_method" do
|
211
|
-
expect do
|
212
|
-
Two.new(method_subject).an_instance_method{|arr| arr << __LINE__}
|
213
|
-
end.to change{method_calls.length}.by(2)
|
214
|
-
method_calls.each do |method_call|
|
215
|
-
method_call[0].method.should == :an_instance_method
|
216
|
-
end
|
217
|
-
|
218
|
-
method_calls.map{|mc| mc[0].context}.should include("One", "Two")
|
219
|
-
end
|
220
|
-
|
221
|
-
it "should collect calls made on Two#a_class_method" do
|
222
|
-
expect do
|
223
|
-
Two.a_class_method(method_subject){|arr| arr << __LINE__}
|
224
|
-
end.to change{method_calls.length}.by(2)
|
225
|
-
method_calls.each do |method_call|
|
226
|
-
method_call[0].method.should == :a_class_method
|
227
|
-
end
|
228
|
-
|
229
|
-
method_calls.map{|mc| mc[0].context}.should include("One", "Two")
|
230
|
-
end
|
231
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Rack::Insight::Config do
|
4
|
-
|
5
|
-
context "configured with panel_load_paths" do
|
6
|
-
before(:each) do
|
7
|
-
Rack::Insight::Config.configure do |config|
|
8
|
-
# spec folder is in the load path during specs!
|
9
|
-
config[:panel_load_paths] << 'fixtures'
|
10
|
-
end
|
11
|
-
require 'fixtures/star_trek_panel'
|
12
|
-
reset_insight :panel_files => %w{star_trek_panel}
|
13
|
-
end
|
14
|
-
it "should use StarTrekPanel" do
|
15
|
-
app.insight_app.panel_classes.include?(StarTrekPanel).should be_true
|
16
|
-
#get_via_rack "/"
|
17
|
-
response = get "/", :content_type => "application/xhtml+xml"
|
18
|
-
response.should have_selector("table#StarTrek", :content => 'Enterprise')
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
end
|
@@ -1,44 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'rack/insight/panels/active_record_panel'
|
3
|
-
|
4
|
-
module Rack::Insight
|
5
|
-
describe "ActiveRecordPanel" do
|
6
|
-
before do
|
7
|
-
mock_constant("ActiveRecord::Base")
|
8
|
-
reset_insight :panel_classes => [Rack::Insight::ActiveRecordPanel]
|
9
|
-
end
|
10
|
-
|
11
|
-
def mock_model(name)
|
12
|
-
model = double("model")
|
13
|
-
model.stub(:name => name)
|
14
|
-
obj = double(name)
|
15
|
-
obj.stub(:base_class => model)
|
16
|
-
obj
|
17
|
-
end
|
18
|
-
|
19
|
-
describe "heading" do
|
20
|
-
it "displays the total number of instantiated AR objects" do
|
21
|
-
app.before_return do
|
22
|
-
mock_method_call("ActiveRecord::Base", "allocate", [], :class, mock_model("User"))
|
23
|
-
mock_method_call("ActiveRecord::Base", "allocate", [], :class, mock_model("Group"))
|
24
|
-
end
|
25
|
-
|
26
|
-
response = get_via_rack "/"
|
27
|
-
response.should have_heading("2 AR Objects")
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
describe "content" do
|
32
|
-
it "displays the count of instantiated objects for each class" do
|
33
|
-
app.before_return do
|
34
|
-
mock_method_call("ActiveRecord::Base", "allocate", [], :class, mock_model("User"))
|
35
|
-
mock_method_call("ActiveRecord::Base", "allocate", [], :class, mock_model("User"))
|
36
|
-
mock_method_call("ActiveRecord::Base", "allocate", [], :class, mock_model("Group"))
|
37
|
-
end
|
38
|
-
response = get_via_rack "/"
|
39
|
-
response.should have_row("#ActiveRecordPanel", "User", "2")
|
40
|
-
response.should have_row("#ActiveRecordPanel", "Group", "1")
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
@@ -1,40 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
module Rack::Insight
|
4
|
-
describe "ActiveResourcePanel" do
|
5
|
-
before do
|
6
|
-
mock_constant("ActiveResource::Connection")
|
7
|
-
reset_insight :panel_files => %w{active_resource_panel}
|
8
|
-
end
|
9
|
-
|
10
|
-
def mock_model(name)
|
11
|
-
model = double("model")
|
12
|
-
model.stub(:name => name)
|
13
|
-
obj = double(name)
|
14
|
-
obj.stub(:base_class => model)
|
15
|
-
obj
|
16
|
-
end
|
17
|
-
|
18
|
-
describe "heading" do
|
19
|
-
it "displays the total number of instantiated AR objects" do
|
20
|
-
app.before_return do
|
21
|
-
mock_method_call("ActiveResource::Connection", "request", [], :instance, "")
|
22
|
-
mock_method_call("ActiveResource::Connection", "request", [], :instance, "")
|
23
|
-
end
|
24
|
-
|
25
|
-
response = get_via_rack "/"
|
26
|
-
response.should have_heading("ARes: 2 Queries")
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
describe "content", :pending => true do
|
31
|
-
it "displays the count of instantiated objects for each class" do
|
32
|
-
app.before_return do
|
33
|
-
mock_method_call("ActiveResource::Connection", "request", [], :instance, "")
|
34
|
-
mock_method_call("ActiveResource::Connection", "request", [], :instance, "")
|
35
|
-
end
|
36
|
-
response = get_via_rack "/"
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
@@ -1,179 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'rack/insight/panels/cache_panel'
|
3
|
-
|
4
|
-
module Rack::Insight
|
5
|
-
describe "CachePanel" do
|
6
|
-
before do
|
7
|
-
mock_constant("Rails")
|
8
|
-
mock_constant("Memcached")
|
9
|
-
mock_constant("MemCache")
|
10
|
-
reset_insight :panel_classes => [Rack::Insight::CachePanel]
|
11
|
-
end
|
12
|
-
|
13
|
-
describe "heading" do
|
14
|
-
it "displays the total memcache time" do
|
15
|
-
response = get_via_rack "/"
|
16
|
-
response.should have_heading("Cache: 0.00ms")
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
describe "content" do
|
21
|
-
describe "usage table" do
|
22
|
-
it "displays the total number of memcache calls" do
|
23
|
-
app.before_return do
|
24
|
-
mock_method_call("Memcached", "get", ["user:1"])
|
25
|
-
end
|
26
|
-
response = get_via_rack "/"
|
27
|
-
|
28
|
-
# This causes a bus error:
|
29
|
-
# response.should have_selector("th:content('Total Calls') + td", :content => "1")
|
30
|
-
|
31
|
-
response.should have_row("#cache_usage", "Total Calls", "1")
|
32
|
-
end
|
33
|
-
|
34
|
-
it "displays the total memcache time" do
|
35
|
-
response = get_via_rack "/"
|
36
|
-
response.should have_row("#cache_usage", "Total Time", "0.00ms")
|
37
|
-
end
|
38
|
-
|
39
|
-
it "dispays the number of memcache hits" do
|
40
|
-
app.before_return do
|
41
|
-
mock_method_call("Memcached", "get", ["user:1"])
|
42
|
-
end
|
43
|
-
response = get_via_rack "/"
|
44
|
-
response.should have_row("#cache_usage", "Hits", "0")
|
45
|
-
end
|
46
|
-
|
47
|
-
it "displays the number of memcache misses" do
|
48
|
-
app.before_return do
|
49
|
-
mock_method_call("Memcached", "get", ["user:1"])
|
50
|
-
end
|
51
|
-
response = get_via_rack "/"
|
52
|
-
response.should have_row("#cache_usage", "Misses", "1")
|
53
|
-
end
|
54
|
-
|
55
|
-
it "displays the number of memcache gets" do
|
56
|
-
app.before_return do
|
57
|
-
mock_method_call("Memcached", "get", ["user:1"])
|
58
|
-
end
|
59
|
-
response = get_via_rack "/"
|
60
|
-
response.should have_row("#cache_usage", "gets", "1")
|
61
|
-
end
|
62
|
-
|
63
|
-
it "displays the number of memcache sets" do
|
64
|
-
|
65
|
-
app.before_return do
|
66
|
-
mock_method_call("Memcached", "set", ["user:1"])
|
67
|
-
end
|
68
|
-
response = get_via_rack "/"
|
69
|
-
response.should have_row("#cache_usage", "sets", "1")
|
70
|
-
end
|
71
|
-
|
72
|
-
it "displays the number of memcache deletes" do
|
73
|
-
app.before_return do
|
74
|
-
mock_method_call("Memcached", "delete", ["user:1"])
|
75
|
-
end
|
76
|
-
response = get_via_rack "/"
|
77
|
-
response.should have_row("#cache_usage", "deletes", "1")
|
78
|
-
end
|
79
|
-
|
80
|
-
it "displays the number of memcache get_multis" do
|
81
|
-
app.before_return do
|
82
|
-
mock_method_call("MemCache", "get_multi", ["user:1", "user:2"])
|
83
|
-
end
|
84
|
-
response = get_via_rack "/"
|
85
|
-
response.should have_row("#cache_usage", "get_multis", "1")
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
|
-
describe "breakdown" do
|
90
|
-
it "displays each memcache operation" do
|
91
|
-
app.before_return do
|
92
|
-
mock_method_call("Memcached", "get", ["user:1"])
|
93
|
-
end
|
94
|
-
response = get_via_rack "/"
|
95
|
-
response.should have_row("#cache_breakdown", "get")
|
96
|
-
end
|
97
|
-
|
98
|
-
it "displays the time for each memcache call" do
|
99
|
-
app.before_return do
|
100
|
-
mock_method_call("Memcached", "get", ["user:1"])
|
101
|
-
end
|
102
|
-
response = get_via_rack "/"
|
103
|
-
response.should have_row("#cache_breakdown", "user:1", TIME_MS_REGEXP)
|
104
|
-
end
|
105
|
-
|
106
|
-
it "displays the keys for each memcache call" do
|
107
|
-
app.before_return do
|
108
|
-
mock_method_call("Memcached", "get", ["user:1"])
|
109
|
-
end
|
110
|
-
response = get_via_rack "/"
|
111
|
-
response.should have_row("#cache_breakdown", "user:1", "get")
|
112
|
-
end
|
113
|
-
end
|
114
|
-
end
|
115
|
-
|
116
|
-
describe "cache operations" do
|
117
|
-
before do
|
118
|
-
app.insight_app.secret_key = 'abc'
|
119
|
-
response = get_via_rack "/"
|
120
|
-
end
|
121
|
-
|
122
|
-
|
123
|
-
describe "expire_all" do
|
124
|
-
it "expires the cache keys" do
|
125
|
-
Rails.stub(:cache => double("cache"))
|
126
|
-
Rails.cache.should_receive(:delete).with("user:1")
|
127
|
-
Rails.cache.should_receive(:delete).with("user:2")
|
128
|
-
Rails.cache.should_receive(:delete).with("user:3")
|
129
|
-
Rails.cache.should_receive(:delete).with("user:4")
|
130
|
-
|
131
|
-
get_via_rack "/__insight__/delete_cache_list",
|
132
|
-
:keys_1 => "user:1", :keys_2 => "user:2", :keys_3 => "user:3", :keys_4 => "user:4",
|
133
|
-
:hash => Digest::SHA1.hexdigest("abc:user:1:user:2:user:3:user:4")
|
134
|
-
end
|
135
|
-
|
136
|
-
it "returns OK" do
|
137
|
-
Rails.stub(:cache => double("cache", :delete => nil))
|
138
|
-
response = get_via_rack "/__insight__/delete_cache_list",
|
139
|
-
:keys_1 => "user:1", :keys_2 => "user:2", :keys_3 => "user:3", :keys_4 => "user:4",
|
140
|
-
:hash => Digest::SHA1.hexdigest("abc:user:1:user:2:user:3:user:4")
|
141
|
-
response.should contain("OK")
|
142
|
-
end
|
143
|
-
end
|
144
|
-
|
145
|
-
describe "expire" do
|
146
|
-
it "expires the cache key" do
|
147
|
-
Rails.stub(:cache => double("cache"))
|
148
|
-
Rails.cache.should_receive(:delete).with("user:1")
|
149
|
-
get_via_rack "/__insight__/delete_cache", :key => "user:1",
|
150
|
-
:hash => Digest::SHA1.hexdigest("abc:user:1")
|
151
|
-
end
|
152
|
-
|
153
|
-
it "returns OK" do
|
154
|
-
Rails.stub(:cache => double("cache", :delete => nil))
|
155
|
-
response = get_via_rack "/__insight__/delete_cache", :key => "user:1",
|
156
|
-
:hash => Digest::SHA1.hexdigest("abc:user:1")
|
157
|
-
response.should contain("OK")
|
158
|
-
end
|
159
|
-
end
|
160
|
-
|
161
|
-
describe "view_cache" do
|
162
|
-
it "renders the cache key" do
|
163
|
-
Rails.stub(:cache => double("cache", :read => "cache body"))
|
164
|
-
response = get_via_rack "/__insight__/view_cache", :key => "user:1",
|
165
|
-
:hash => Digest::SHA1.hexdigest("abc:user:1")
|
166
|
-
response.should contain("cache body")
|
167
|
-
end
|
168
|
-
|
169
|
-
it "renders non-String cache values properly" do
|
170
|
-
Rails.stub(:cache => double("cache", :read => [1, 2]))
|
171
|
-
response = get_via_rack "/__insight__/view_cache", :key => "user:1",
|
172
|
-
:hash => Digest::SHA1.hexdigest("abc:user:1")
|
173
|
-
response.should contain("[1, 2]")
|
174
|
-
end
|
175
|
-
end
|
176
|
-
|
177
|
-
end
|
178
|
-
end
|
179
|
-
end
|