erector_cache 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/erector_cache/widget.rb +1 -1
- data/spec/erector_cache/widget_spec.rb +36 -2
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.3
|
data/lib/erector_cache/widget.rb
CHANGED
@@ -19,7 +19,21 @@ class Master
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def to_param
|
22
|
-
name
|
22
|
+
@name
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
class Weapon
|
27
|
+
def initialize(name)
|
28
|
+
@name = name
|
29
|
+
end
|
30
|
+
|
31
|
+
def name
|
32
|
+
@name
|
33
|
+
end
|
34
|
+
|
35
|
+
def to_param
|
36
|
+
@name
|
23
37
|
end
|
24
38
|
end
|
25
39
|
|
@@ -74,7 +88,7 @@ describe ErectorCache::Widget do
|
|
74
88
|
@output.should_not include expected_cached_at_time
|
75
89
|
end
|
76
90
|
|
77
|
-
it "
|
91
|
+
it "expires based on cache key component that is a proc" do
|
78
92
|
@he_man = Master.new("He-man")
|
79
93
|
render_template do |controller|
|
80
94
|
controller.render_widget Turtle, :name => "Leonardo", :weapon => "Katanas", :master => @splinter
|
@@ -91,6 +105,26 @@ describe ErectorCache::Widget do
|
|
91
105
|
Lawnchair.redis.keys("*Splinter*").should be_blank
|
92
106
|
Lawnchair.redis.keys("*He-man*").should_not be_blank
|
93
107
|
end
|
108
|
+
|
109
|
+
it "expires based on regular object with to_param" do
|
110
|
+
@he_man = Master.new("He-man")
|
111
|
+
@shell = Weapon.new("Shell")
|
112
|
+
|
113
|
+
render_template do |controller|
|
114
|
+
controller.render_widget Turtle, :name => "Leonardo", :weapon => Weapon.new("Katanas"), :master => @splinter
|
115
|
+
end
|
116
|
+
|
117
|
+
render_template do |controller|
|
118
|
+
controller.render_widget Turtle, :name => "Myrtle", :weapon => @shell, :master => @he_man
|
119
|
+
end
|
120
|
+
|
121
|
+
Lawnchair.redis.keys("*Shell*").should_not be_blank
|
122
|
+
Lawnchair.redis.keys("*Katanas*").should_not be_blank
|
123
|
+
NinjaTurtle.expire!(:weapon => @shell)
|
124
|
+
|
125
|
+
Lawnchair.redis.keys("*Shell*").should be_blank
|
126
|
+
Lawnchair.redis.keys("*Katanas*").should_not be_blank
|
127
|
+
end
|
94
128
|
end
|
95
129
|
|
96
130
|
describe ".cache_for" do
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: erector_cache
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 3
|
10
|
+
version: 0.0.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Grockit
|