cells 3.8.8 → 3.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +2 -1
- data/.travis.yml +5 -2
- data/CHANGES.textile +23 -15
- data/Gemfile +1 -1
- data/README.md +412 -0
- data/Rakefile +2 -2
- data/cells.gemspec +5 -6
- data/gemfiles/Gemfile.rails3-0 +2 -2
- data/gemfiles/Gemfile.rails3-1 +1 -1
- data/gemfiles/Gemfile.rails3-2 +1 -2
- data/gemfiles/Gemfile.rails4-0 +7 -0
- data/lib/cell.rb +27 -0
- data/lib/cell/base.rb +31 -18
- data/lib/cell/builder.rb +11 -10
- data/lib/cell/dsl.rb +7 -0
- data/lib/cell/rack.rb +5 -9
- data/lib/cell/rails.rb +19 -11
- data/lib/cell/rails/view_model.rb +115 -0
- data/lib/cell/rails3_0_strategy.rb +1 -1
- data/lib/cell/rails3_1_strategy.rb +1 -1
- data/lib/cell/rails4_0_strategy.rb +1 -2
- data/lib/cell/test_case.rb +11 -11
- data/lib/cells.rb +4 -3
- data/lib/cells/rails.rb +16 -3
- data/lib/cells/version.rb +1 -1
- data/test/app/cells/bassist_cell.rb +9 -1
- data/test/app/cells/rails_helper_api_test/bassist/edit.html.erb +3 -3
- data/test/app/cells/song/dashboard.haml +7 -0
- data/test/app/cells/song/details.html.haml +1 -0
- data/test/app/cells/song/info.html.haml +1 -0
- data/test/app/cells/song/lyrics.html.haml +6 -0
- data/test/app/cells/song/plays.haml +1 -0
- data/test/app/cells/song/show.html.haml +3 -0
- data/test/app/cells/song/title.html.haml +1 -0
- data/test/app/cells/view_model_test/comments/show.haml +7 -0
- data/test/cell_module_test.rb +39 -41
- data/test/cell_test.rb +28 -0
- data/test/dummy/app/views/musician/featured_with_block.html.erb +1 -1
- data/test/dummy/app/views/musician/title.erb +1 -0
- data/test/dummy/config/routes.rb +1 -0
- data/test/helper_test.rb +13 -10
- data/test/rails/caching_test.rb +75 -73
- data/test/rails/cells_test.rb +25 -23
- data/test/rails/integration_test.rb +80 -61
- data/test/rails/view_model_test.rb +119 -0
- data/test/rails_helper_api_test.rb +11 -13
- metadata +41 -61
- data/README.rdoc +0 -279
- data/about.yml +0 -7
- data/test/app/cells/producer/capture.html.erb +0 -1
- data/test/app/cells/producer/content_for.html.erb +0 -2
- data/test/rails/capture_test.rb +0 -70
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= cell("controller_methods_test/song", :title => "First Call").title %>
|
data/test/dummy/config/routes.rb
CHANGED
data/test/helper_test.rb
CHANGED
|
@@ -9,7 +9,7 @@ end
|
|
|
9
9
|
|
|
10
10
|
class DrummerCell < Cell::Rails
|
|
11
11
|
helper StringHelper
|
|
12
|
-
|
|
12
|
+
|
|
13
13
|
def assist
|
|
14
14
|
render :inline => "<%= pick %>"
|
|
15
15
|
end
|
|
@@ -18,19 +18,22 @@ end
|
|
|
18
18
|
|
|
19
19
|
class HelperTest < MiniTest::Spec
|
|
20
20
|
include Cell::TestCase::TestMethods
|
|
21
|
-
|
|
21
|
+
|
|
22
22
|
describe "a cell with included helper modules" do
|
|
23
23
|
class SongCell < Cell::Rails
|
|
24
24
|
include ActionView::Helpers::TagHelper # for Rails 3.0.
|
|
25
25
|
include ActionView::Helpers::AssetTagHelper
|
|
26
26
|
|
|
27
27
|
def show
|
|
28
|
+
controller.config.relative_url_root = "" if Cell.rails3_0?
|
|
28
29
|
image_tag("no-more-the-meek.jpg")
|
|
29
30
|
end
|
|
30
31
|
end
|
|
31
32
|
|
|
32
33
|
it "allows using helpers using #controller on instance level" do
|
|
33
|
-
|
|
34
|
+
alt = "No-more-the-meek"
|
|
35
|
+
alt = "No more the meek" if Cell.rails4_0_or_more?
|
|
36
|
+
assert_equal "<img alt=\"#{alt}\" src=\"/images/no-more-the-meek.jpg\" />", render_cell("helper_test/song", :show)
|
|
34
37
|
end
|
|
35
38
|
end
|
|
36
39
|
|
|
@@ -42,32 +45,32 @@ class HelperTest < MiniTest::Spec
|
|
|
42
45
|
render :inline => "<%= submit_tag %>"
|
|
43
46
|
end
|
|
44
47
|
end
|
|
45
|
-
|
|
48
|
+
|
|
46
49
|
assert_equal "<input name=\"commit\" type=\"submit\" value=\"Save changes\" />", render_cell(:bassist, :assist)
|
|
47
50
|
end
|
|
48
|
-
|
|
51
|
+
|
|
49
52
|
it "have access to methods declared with #helper_method" do
|
|
50
53
|
BassistCell.class_eval do
|
|
51
54
|
def help; "Great!"; end
|
|
52
55
|
helper_method :help
|
|
53
|
-
|
|
56
|
+
|
|
54
57
|
def assist
|
|
55
58
|
render :inline => "<%= help %>"
|
|
56
59
|
end
|
|
57
60
|
end
|
|
58
|
-
|
|
61
|
+
|
|
59
62
|
assert_equal "Great!", render_cell(:bassist, :assist)
|
|
60
63
|
end
|
|
61
|
-
|
|
64
|
+
|
|
62
65
|
it "have access to methods provided by helper" do
|
|
63
66
|
assert_equal "plong", render_cell(:drummer, :assist)
|
|
64
67
|
end
|
|
65
|
-
|
|
68
|
+
|
|
66
69
|
it "mix in required helpers, only" do
|
|
67
70
|
assert_equal "false true", render_cell(:"club_security/medic", :help)
|
|
68
71
|
assert_equal "true false", render_cell(:"club_security/guard", :help)
|
|
69
72
|
end
|
|
70
|
-
|
|
73
|
+
|
|
71
74
|
it "include helpers only once" do
|
|
72
75
|
assert_equal "false true", render_cell(:"club_security/medic", :help)
|
|
73
76
|
assert_equal "true false", render_cell(:"club_security/guard", :help)
|
data/test/rails/caching_test.rb
CHANGED
|
@@ -3,12 +3,12 @@ require 'test_helper'
|
|
|
3
3
|
|
|
4
4
|
class DirectorCell < Cell::Rails
|
|
5
5
|
attr_reader :count
|
|
6
|
-
|
|
6
|
+
|
|
7
7
|
def initialize(*)
|
|
8
8
|
super
|
|
9
9
|
@count = 0
|
|
10
10
|
end
|
|
11
|
-
|
|
11
|
+
|
|
12
12
|
cache :tock
|
|
13
13
|
def tock
|
|
14
14
|
@count += 1
|
|
@@ -23,20 +23,20 @@ end
|
|
|
23
23
|
|
|
24
24
|
class CachingUnitTest < MiniTest::Spec
|
|
25
25
|
include Cell::TestCase::TestMethods
|
|
26
|
-
|
|
26
|
+
|
|
27
27
|
before :each do
|
|
28
28
|
ActionController::Base.cache_store.clear
|
|
29
29
|
ActionController::Base.perform_caching = true
|
|
30
30
|
@cell = cell(:director)
|
|
31
31
|
@class = @cell.class
|
|
32
32
|
end
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
|
|
34
|
+
|
|
35
35
|
describe ".state_cache_key" do
|
|
36
36
|
it "accept state only" do
|
|
37
37
|
assert_equal "cells/director/count/", @class.state_cache_key(:count)
|
|
38
38
|
end
|
|
39
|
-
|
|
39
|
+
|
|
40
40
|
it "accept hash as key parts" do
|
|
41
41
|
if Cell.rails4_0_or_more?
|
|
42
42
|
assert_equal "cells/director/count/b/2/a/1", @class.state_cache_key(:count, :b=>2, :a=>1)
|
|
@@ -44,64 +44,64 @@ class CachingUnitTest < MiniTest::Spec
|
|
|
44
44
|
assert_equal "cells/director/count/a=1&b=2", @class.state_cache_key(:count, :b=>2, :a=>1)
|
|
45
45
|
end
|
|
46
46
|
end
|
|
47
|
-
|
|
47
|
+
|
|
48
48
|
it "accept array as key parts" do
|
|
49
49
|
assert_equal "cells/director/count/1/2/3", @class.state_cache_key(:count, [1,2,3])
|
|
50
50
|
end
|
|
51
|
-
|
|
51
|
+
|
|
52
52
|
it "accept string as key parts" do
|
|
53
53
|
assert_equal "cells/director/count/1/2", @class.state_cache_key(:count, "1/2")
|
|
54
54
|
end
|
|
55
|
-
|
|
55
|
+
|
|
56
56
|
it "accept nil as key parts" do
|
|
57
57
|
assert_equal "cells/director/count/", @class.state_cache_key(:count, nil)
|
|
58
58
|
end
|
|
59
59
|
end
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
|
|
61
|
+
|
|
62
62
|
describe "#state_cached?" do
|
|
63
63
|
it "return true for cached" do
|
|
64
64
|
assert @cell.send :state_cached?, :tock
|
|
65
65
|
end
|
|
66
|
-
|
|
66
|
+
|
|
67
67
|
it "return false otherwise" do
|
|
68
68
|
assert_not @cell.send :state_cached?, :sing
|
|
69
69
|
end
|
|
70
70
|
end
|
|
71
|
-
|
|
72
|
-
|
|
71
|
+
|
|
72
|
+
|
|
73
73
|
describe "#cache?" do
|
|
74
74
|
it "return true for cached" do
|
|
75
75
|
assert @cell.cache?(:tock)
|
|
76
76
|
end
|
|
77
|
-
|
|
77
|
+
|
|
78
78
|
it "return false otherwise" do
|
|
79
79
|
assert_not @cell.cache?(:sing)
|
|
80
80
|
end
|
|
81
|
-
|
|
81
|
+
|
|
82
82
|
describe "perform_caching turned off" do
|
|
83
83
|
after :each do
|
|
84
84
|
::ActionController::Base.perform_caching = true
|
|
85
85
|
end
|
|
86
|
-
|
|
86
|
+
|
|
87
87
|
it "always return false if caching turned-off" do
|
|
88
88
|
::ActionController::Base.perform_caching = false
|
|
89
89
|
assert_not @cell.cache?(:count)
|
|
90
90
|
assert_not @cell.cache?(:sing)
|
|
91
91
|
end
|
|
92
92
|
end
|
|
93
|
-
|
|
93
|
+
|
|
94
94
|
describe ".cache_store" do
|
|
95
95
|
it "return Rails cache store per default" do
|
|
96
96
|
assert_equal ActionController::Base.cache_store, DirectorCell.cache_store
|
|
97
97
|
end
|
|
98
|
-
|
|
98
|
+
|
|
99
99
|
describe "Cell::Base" do
|
|
100
100
|
before :each do
|
|
101
101
|
@class = Class.new(Cell::Base)
|
|
102
102
|
@cell = @class.new
|
|
103
103
|
end
|
|
104
|
-
|
|
104
|
+
|
|
105
105
|
describe "#cache_store" do
|
|
106
106
|
it "be setable from the outside" do
|
|
107
107
|
assert_equal nil, @cell.cache_store
|
|
@@ -109,7 +109,7 @@ class CachingUnitTest < MiniTest::Spec
|
|
|
109
109
|
assert_equal Object, @cell.cache_store
|
|
110
110
|
end
|
|
111
111
|
end
|
|
112
|
-
|
|
112
|
+
|
|
113
113
|
describe "#cache_configured?" do
|
|
114
114
|
it "be setable from the outside" do
|
|
115
115
|
assert_equal nil, @cell.cache_configured?
|
|
@@ -117,38 +117,38 @@ class CachingUnitTest < MiniTest::Spec
|
|
|
117
117
|
assert_equal true, @cell.cache_configured?
|
|
118
118
|
end
|
|
119
119
|
end
|
|
120
|
-
|
|
120
|
+
|
|
121
121
|
end
|
|
122
122
|
end
|
|
123
123
|
end
|
|
124
|
-
|
|
125
|
-
|
|
124
|
+
|
|
125
|
+
|
|
126
126
|
describe ".expire_cache_key" do
|
|
127
127
|
before :each do
|
|
128
128
|
@key = @class.state_cache_key(:tock)
|
|
129
129
|
assert_equal "1", render_cell(:director, :tock)
|
|
130
130
|
assert_equal "1", @class.cache_store.read(@key)
|
|
131
131
|
end
|
|
132
|
-
|
|
132
|
+
|
|
133
133
|
it "delete the state from cache" do
|
|
134
134
|
@class.expire_cache_key(@key)
|
|
135
135
|
assert_not @class.cache_store.read(@key)
|
|
136
136
|
end
|
|
137
|
-
|
|
137
|
+
|
|
138
138
|
it "be available in controllers for sweepers" do
|
|
139
139
|
MusicianController.new.expire_cell_state(DirectorCell, :tock)
|
|
140
140
|
assert_not @class.cache_store.read(@key)
|
|
141
141
|
end
|
|
142
|
-
|
|
142
|
+
|
|
143
143
|
it "accept cache options" do
|
|
144
144
|
key = @class.state_cache_key(:tock, :volume => 9)
|
|
145
145
|
assert Cell::Rails.cache_store.write(key, 'ONE!')
|
|
146
|
-
|
|
146
|
+
|
|
147
147
|
MusicianController.new.expire_cell_state(DirectorCell, :tock, :volume => 9)
|
|
148
148
|
assert_equal "1", @class.cache_store.read(@key)
|
|
149
149
|
assert_not ::Cell::Rails.cache_store.read(key)
|
|
150
150
|
end
|
|
151
|
-
|
|
151
|
+
|
|
152
152
|
include ActiveSupport::Testing::Deprecation
|
|
153
153
|
it "raise a deprecation notice when passing in a :symbol" do
|
|
154
154
|
assert_deprecated do
|
|
@@ -157,45 +157,45 @@ class CachingUnitTest < MiniTest::Spec
|
|
|
157
157
|
assert_not @class.cache_store.read(@key)
|
|
158
158
|
end
|
|
159
159
|
end
|
|
160
|
-
|
|
161
|
-
|
|
160
|
+
|
|
161
|
+
|
|
162
162
|
describe ".cache" do
|
|
163
163
|
let (:proc) { Proc.new {} }
|
|
164
164
|
let (:parent) { Class.new(Cell::Base) }
|
|
165
165
|
let (:brother) { Class.new(parent) }
|
|
166
166
|
let (:sister) { Class.new(parent) }
|
|
167
|
-
|
|
167
|
+
|
|
168
168
|
it "accept a state name, only" do
|
|
169
169
|
@class.cache :count
|
|
170
|
-
|
|
170
|
+
|
|
171
171
|
assert_not @class.version_procs[:count]
|
|
172
172
|
assert_equal({}, @class.cache_options[:count])
|
|
173
173
|
end
|
|
174
|
-
|
|
174
|
+
|
|
175
175
|
it "accept state and cache options" do
|
|
176
176
|
@class.cache :count, :expires_in => 10.minutes
|
|
177
|
-
|
|
177
|
+
|
|
178
178
|
assert_not @class.version_procs[:count]
|
|
179
179
|
assert_equal({:expires_in => 10.minutes}, @class.cache_options[:count])
|
|
180
180
|
end
|
|
181
|
-
|
|
181
|
+
|
|
182
182
|
it "accept args and versioner block" do
|
|
183
183
|
@class.cache :count, :expires_in => 10.minutes do "v1" end
|
|
184
184
|
|
|
185
185
|
assert_kind_of Proc, @class.version_procs[:count]
|
|
186
186
|
assert_equal({:expires_in => 10.minutes}, @class.cache_options[:count])
|
|
187
187
|
end
|
|
188
|
-
|
|
188
|
+
|
|
189
189
|
it "stil accept a versioner proc, only" do
|
|
190
190
|
@class.cache :count, proc
|
|
191
|
-
|
|
191
|
+
|
|
192
192
|
assert_equal proc, @class.version_procs[:count]
|
|
193
193
|
assert_equal({}, @class.cache_options[:count])
|
|
194
194
|
end
|
|
195
|
-
|
|
195
|
+
|
|
196
196
|
it "stil accept a versioner block" do
|
|
197
197
|
@class.cache :count do "v1" end
|
|
198
|
-
|
|
198
|
+
|
|
199
199
|
assert_kind_of Proc, @class.version_procs[:count]
|
|
200
200
|
assert_equal({}, @class.cache_options[:count])
|
|
201
201
|
end
|
|
@@ -239,21 +239,21 @@ class CachingFunctionalTest < MiniTest::Spec
|
|
|
239
239
|
ActionController::Base.cache_store.clear
|
|
240
240
|
ActionController::Base.perform_caching = true
|
|
241
241
|
#setup # from Cell::TestCase::TestMethods
|
|
242
|
-
|
|
242
|
+
|
|
243
243
|
@cell = cell(:director)
|
|
244
244
|
@class = @cell.class
|
|
245
245
|
end
|
|
246
|
-
|
|
246
|
+
|
|
247
247
|
describe "turned off" do
|
|
248
248
|
it "not invoke caching" do
|
|
249
249
|
::ActionController::Base.perform_caching = false
|
|
250
|
-
|
|
250
|
+
|
|
251
251
|
assert_equal "1", @cell.render_state(:tock)
|
|
252
252
|
assert_equal "2", @cell.render_state(:tock)
|
|
253
253
|
end
|
|
254
|
-
end
|
|
255
|
-
|
|
256
|
-
|
|
254
|
+
end
|
|
255
|
+
|
|
256
|
+
|
|
257
257
|
describe "without options" do
|
|
258
258
|
it "cache forever" do
|
|
259
259
|
@class.cache :tock
|
|
@@ -261,8 +261,8 @@ class CachingFunctionalTest < MiniTest::Spec
|
|
|
261
261
|
assert_equal "1", render_cell(:director, :tock)
|
|
262
262
|
end
|
|
263
263
|
end
|
|
264
|
-
|
|
265
|
-
|
|
264
|
+
|
|
265
|
+
|
|
266
266
|
describe "uncached states" do
|
|
267
267
|
it "not cache at all" do
|
|
268
268
|
@class.class_eval do
|
|
@@ -271,12 +271,12 @@ class CachingFunctionalTest < MiniTest::Spec
|
|
|
271
271
|
render :text => (@count += 1)
|
|
272
272
|
end
|
|
273
273
|
end
|
|
274
|
-
|
|
274
|
+
|
|
275
275
|
assert_equal "1", @cell.render_state(:dictate)
|
|
276
276
|
assert_equal "2", @cell.render_state(:dictate)
|
|
277
277
|
end
|
|
278
278
|
end
|
|
279
|
-
|
|
279
|
+
|
|
280
280
|
describe "with versioner" do
|
|
281
281
|
before do
|
|
282
282
|
@class.class_eval do
|
|
@@ -285,19 +285,19 @@ class CachingFunctionalTest < MiniTest::Spec
|
|
|
285
285
|
end
|
|
286
286
|
end
|
|
287
287
|
end
|
|
288
|
-
|
|
288
|
+
|
|
289
289
|
it "compute the key with a block receiving state-args" do
|
|
290
290
|
@class.cache :count do |cell, int|
|
|
291
291
|
(int % 2)==0 ? {:count => "even"} : {:count => "odd"}
|
|
292
292
|
end
|
|
293
293
|
# example cache key: cells/director/count/count=odd
|
|
294
|
-
|
|
294
|
+
|
|
295
295
|
assert_equal "1", render_cell(:director, :count, 1)
|
|
296
296
|
assert_equal "2", render_cell(:director, :count, 2)
|
|
297
297
|
assert_equal "1", render_cell(:director, :count, 3)
|
|
298
298
|
assert_equal "2", render_cell(:director, :count, 4)
|
|
299
299
|
end
|
|
300
|
-
|
|
300
|
+
|
|
301
301
|
it "compute the key with an instance method" do
|
|
302
302
|
@class.cache :count, :version
|
|
303
303
|
@class.class_eval do
|
|
@@ -306,33 +306,33 @@ class CachingFunctionalTest < MiniTest::Spec
|
|
|
306
306
|
(int % 2)==0 ? {:count => "even"} : {:count => "odd"}
|
|
307
307
|
end
|
|
308
308
|
end
|
|
309
|
-
|
|
309
|
+
|
|
310
310
|
assert_equal "1", render_cell(:director, :count, 1)
|
|
311
311
|
assert_equal "2", render_cell(:director, :count, 2)
|
|
312
312
|
assert_equal "1", render_cell(:director, :count, 3)
|
|
313
313
|
assert_equal "2", render_cell(:director, :count, 4)
|
|
314
314
|
end
|
|
315
|
-
|
|
315
|
+
|
|
316
316
|
it "allow returning strings, too" do
|
|
317
317
|
@class.cache :count do |cell, int|
|
|
318
318
|
(int % 2)==0 ? "even" : "odd"
|
|
319
319
|
end
|
|
320
|
-
|
|
320
|
+
|
|
321
321
|
assert_equal "1", render_cell(:director, :count, 1)
|
|
322
322
|
assert_equal "2", render_cell(:director, :count, 2)
|
|
323
323
|
assert_equal "1", render_cell(:director, :count, 3)
|
|
324
324
|
assert_equal "2", render_cell(:director, :count, 4)
|
|
325
325
|
end
|
|
326
|
-
|
|
326
|
+
|
|
327
327
|
it "be able to use caching conditionally" do
|
|
328
328
|
@class.cache :count, :if => proc { |cell, int| (int % 2) != 0 }
|
|
329
|
-
|
|
329
|
+
|
|
330
330
|
assert_equal "1", render_cell(:director, :count, 1)
|
|
331
331
|
assert_equal "2", render_cell(:director, :count, 2)
|
|
332
332
|
assert_equal "1", render_cell(:director, :count, 3)
|
|
333
333
|
assert_equal "4", render_cell(:director, :count, 4)
|
|
334
334
|
end
|
|
335
|
-
|
|
335
|
+
|
|
336
336
|
it "cache conditionally with an instance method" do
|
|
337
337
|
@class.cache :count, :if => :odd?
|
|
338
338
|
@class.class_eval do
|
|
@@ -340,43 +340,45 @@ class CachingFunctionalTest < MiniTest::Spec
|
|
|
340
340
|
(int % 2) != 0
|
|
341
341
|
end
|
|
342
342
|
end
|
|
343
|
-
|
|
343
|
+
|
|
344
344
|
assert_equal "1", render_cell(:director, :count, 1)
|
|
345
345
|
assert_equal "2", render_cell(:director, :count, 2)
|
|
346
346
|
assert_equal "1", render_cell(:director, :count, 3)
|
|
347
347
|
assert_equal "4", render_cell(:director, :count, 4)
|
|
348
348
|
end
|
|
349
|
-
|
|
349
|
+
|
|
350
350
|
it "allow using a different cache store" do
|
|
351
351
|
class BassistCell < Cell::Base
|
|
352
352
|
cache :play
|
|
353
|
-
|
|
353
|
+
|
|
354
354
|
def play(song)
|
|
355
355
|
render :text => song
|
|
356
356
|
end
|
|
357
357
|
end
|
|
358
|
-
|
|
358
|
+
|
|
359
359
|
@cell = BassistCell.new
|
|
360
|
-
|
|
360
|
+
|
|
361
361
|
assert_equal "New Years", @cell.render_state(:play, "New Years")
|
|
362
362
|
assert_equal "Liar", @cell.render_state(:play, "Liar")
|
|
363
|
-
|
|
363
|
+
|
|
364
364
|
@cell.cache_configured = true
|
|
365
365
|
@cell.cache_store = ActiveSupport::Cache::MemoryStore.new
|
|
366
|
-
|
|
366
|
+
|
|
367
367
|
assert_equal "New Years", @cell.render_state(:play, "New Years")
|
|
368
368
|
assert_equal "New Years", @cell.render_state(:play, "Liar")
|
|
369
369
|
end
|
|
370
370
|
end
|
|
371
371
|
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
372
|
+
unless ::ActionPack::VERSION::MAJOR == 3 and ::ActionPack::VERSION::MINOR >= 2 # bug in 3.2.
|
|
373
|
+
describe "utf-8" do
|
|
374
|
+
before do
|
|
375
|
+
@key = @class.state_cache_key(:utf8)
|
|
376
|
+
end
|
|
376
377
|
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
378
|
+
it "have the correct encoding when reading from cache" do
|
|
379
|
+
assert_equal "UTF-8", render_cell(:director, :utf8).encoding.to_s
|
|
380
|
+
assert_equal "UTF-8", @class.cache_store.read(@key).encoding.to_s
|
|
381
|
+
end
|
|
380
382
|
end
|
|
381
383
|
end
|
|
382
384
|
end
|