cells 3.3.10 → 3.4.0.beta1

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.
Files changed (103) hide show
  1. data/CHANGES +0 -8
  2. data/Gemfile +4 -1
  3. data/README.rdoc +91 -107
  4. data/Rakefile +0 -4
  5. data/lib/cell.rb +5 -6
  6. data/lib/{cells/cell → cell}/active_helper.rb +1 -1
  7. data/lib/cell/base.rb +134 -0
  8. data/lib/cell/base_methods.rb +100 -0
  9. data/lib/cell/caching.rb +153 -0
  10. data/lib/cell/rails.rb +239 -0
  11. data/lib/cells.rb +25 -3
  12. data/lib/cells/assertions_helper.rb +1 -1
  13. data/lib/cells/helpers/capture_helper.rb +3 -3
  14. data/lib/cells/rails.rb +65 -4
  15. data/lib/cells/version.rb +3 -1
  16. data/rails_generators/cell/cell_generator.rb +47 -35
  17. data/rails_generators/cell/templates/cell.rb +1 -1
  18. data/rails_generators/cells_install/cells_install_generator.rb +5 -3
  19. data/rails_generators/erb/cell_generator.rb +20 -0
  20. data/rails_generators/{cell → erb}/templates/view.html.erb +0 -0
  21. data/test/active_helper_test.rb +1 -0
  22. data/test/app/cells/bad_guitarist_cell.rb +2 -0
  23. data/test/app/cells/bassist_cell.rb +1 -1
  24. data/test/app/controllers/musician_controller.rb +16 -0
  25. data/test/assertions_helper_test.rb +8 -18
  26. data/test/base_methods_test.rb +40 -0
  27. data/test/cell_generator_test.rb +33 -21
  28. data/test/helper_test.rb +31 -123
  29. data/test/rails/caching_test.rb +215 -0
  30. data/test/rails/capture_test.rb +52 -0
  31. data/test/rails/cells_test.rb +88 -0
  32. data/test/rails/integration_test.rb +37 -0
  33. data/test/rails/render_test.rb +140 -0
  34. data/test/rails/router_test.rb +74 -0
  35. data/test/rails/view_test.rb +24 -0
  36. data/test/test_helper.rb +30 -29
  37. metadata +68 -133
  38. data/.gitignore +0 -3
  39. data/about.yml +0 -7
  40. data/cells.gemspec +0 -26
  41. data/lib/cells/cell.rb +0 -16
  42. data/lib/cells/cell/base.rb +0 -470
  43. data/lib/cells/cell/caching.rb +0 -163
  44. data/lib/cells/cell/test_case.rb +0 -158
  45. data/lib/cells/cell/view.rb +0 -55
  46. data/lib/cells/rails/action_controller.rb +0 -37
  47. data/lib/cells/rails/action_view.rb +0 -37
  48. data/rails/init.rb +0 -44
  49. data/rails_generators/cells_install/templates/tasks.rake +0 -6
  50. data/test/app/cells/a/another_state.html.erb +0 -1
  51. data/test/app/cells/a/existing_view.html.erb +0 -1
  52. data/test/app/cells/a/inherited_view.html.erb +0 -1
  53. data/test/app/cells/a/inherited_view.js.erb +0 -1
  54. data/test/app/cells/a/view_with_locals.html.erb +0 -1
  55. data/test/app/cells/a/view_with_render_call.html.erb +0 -1
  56. data/test/app/cells/b/existing_view.html.erb +0 -1
  57. data/test/app/cells/b/existing_view.js.erb +0 -1
  58. data/test/app/cells/b/layouts/metal.html.erb +0 -1
  59. data/test/app/cells/b/view_with_render_call.html.erb +0 -1
  60. data/test/app/cells/bassist/jam.html.erb +0 -3
  61. data/test/app/cells/bassist/play.html.erb +0 -1
  62. data/test/app/cells/cells_test_one/renamed_instance_view.html.erb +0 -1
  63. data/test/app/cells/cells_test_one/super_state.html.erb +0 -1
  64. data/test/app/cells/cells_test_one_cell.rb +0 -20
  65. data/test/app/cells/cells_test_two_cell.rb +0 -4
  66. data/test/app/cells/helper_using/state_using_application_helper.html.erb +0 -3
  67. data/test/app/cells/helper_using/state_with_automatic_helper_invocation.html.erb +0 -3
  68. data/test/app/cells/helper_using/state_with_helper_invocation.html.erb +0 -3
  69. data/test/app/cells/helper_using/state_with_helper_method_invocation.html.erb +0 -3
  70. data/test/app/cells/layouts/metal.html.erb +0 -1
  71. data/test/app/cells/my_child/hello.html.erb +0 -1
  72. data/test/app/cells/my_mother/bye.html.erb +0 -1
  73. data/test/app/cells/my_mother/hello.html.erb +0 -1
  74. data/test/app/cells/my_test/_broken_partial.html.erb +0 -1
  75. data/test/app/cells/my_test/_partial.html.erb +0 -1
  76. data/test/app/cells/my_test/state_with_instance_var.html.erb +0 -1
  77. data/test/app/cells/my_test/state_with_link_to.html.erb +0 -3
  78. data/test/app/cells/my_test/state_with_not_included_helper_method.html.erb +0 -8
  79. data/test/app/cells/my_test/view_containing_broken_partial.html.erb +0 -3
  80. data/test/app/cells/my_test/view_containing_nonexistant_partial.html.erb +0 -3
  81. data/test/app/cells/my_test/view_containing_partial.html.erb +0 -3
  82. data/test/app/cells/my_test/view_containing_partial_without_cell_name.html.erb +0 -3
  83. data/test/app/cells/my_test/view_in_local_test_views_dir.html.erb +0 -1
  84. data/test/app/cells/my_test/view_with_explicit_english_translation.en.html.erb +0 -1
  85. data/test/app/cells/my_test/view_with_explicit_english_translation.html.erb +0 -1
  86. data/test/app/cells/my_test/view_with_instance_var.html.erb +0 -4
  87. data/test/app/cells/really_module/nested/happy_state.html.erb +0 -1
  88. data/test/app/cells/really_module/nested_cell.rb +0 -11
  89. data/test/app/cells/simple/two_templates_state.html.mytpl +0 -1
  90. data/test/app/cells/simple_cell.rb +0 -7
  91. data/test/app/cells/test/beep.html.erb +0 -1
  92. data/test/app/cells/test/state_invoking_capture.html.erb +0 -7
  93. data/test/app/cells/test/state_invoking_content_for.html.erb +0 -7
  94. data/test/app/cells/test/state_invoking_content_for_twice.html.erb +0 -9
  95. data/test/app/cells/test/state_with_not_included_helper_method.html.erb +0 -8
  96. data/test/app/cells/two_helpers_including/state_using_another_helper.html.erb +0 -3
  97. data/test/bugs_test.rb +0 -23
  98. data/test/caching_test.rb +0 -270
  99. data/test/capture_helper_test.rb +0 -59
  100. data/test/cells_test.rb +0 -352
  101. data/test/rails_test.rb +0 -35
  102. data/test/render_test.rb +0 -305
  103. data/test/test_case_test.rb +0 -106
@@ -1,44 +0,0 @@
1
- # encoding: utf-8
2
- require 'cells'
3
-
4
- # Tell *Rails* to load files in path:
5
- #
6
- # * +app/cells+
7
- #
8
- dep = ::ActiveSupport::Dependencies
9
-
10
- if dep.respond_to?(:autoload_paths)
11
- dep.autoload_paths << Rails.root.join(*%w[app cells])
12
- else
13
- dep.load_paths << Rails.root.join(*%w[app cells])
14
- end
15
-
16
- # Rails initialization hook.
17
- if defined?(Rails)
18
- Rails.configuration.after_initialize do
19
- initializer.loaded_plugins.each do |plugin|
20
- engine_cells_dir = File.join(plugin.directory, *%w[app cells])
21
-
22
- if plugin.engine? && File.exists?(engine_cells_dir)
23
- # propagate the view- and code path of this engine-cell:
24
- ::Cell::Base.view_paths << engine_cells_dir
25
- if dep.respond_to?(:autoload_paths)
26
- dep.autoload_paths << engine_cells_dir
27
- else
28
- dep.load_paths << engine_cells_dir
29
- end
30
-
31
- # if a path is in +load_once_path+ it won't be reloaded between requests.
32
- unless config.reload_plugins?
33
- if dep.respond_to?(:autoload_once_paths)
34
- dep.autoload_once_paths << engine_cells_dir
35
- else
36
- dep.load_once_paths << engine_cells_dir
37
- end
38
- end
39
- end
40
- end
41
- end
42
- else
43
- puts "[cells:] NOTE: Rails environment not available. Running isolated."
44
- end
@@ -1,6 +0,0 @@
1
- namespace "test" do
2
- Rake::TestTask.new(:cells) do |t|
3
- t.libs << "test"
4
- t.pattern = 'test/cells/**/*_test.rb'
5
- end
6
- end
@@ -1 +0,0 @@
1
- A/another_state/<%= @a %>,<%= @b %>
@@ -1 +0,0 @@
1
- A/existing_view/<%= @a %>
@@ -1 +0,0 @@
1
- A/inherited_view/<%= @a %>
@@ -1 +0,0 @@
1
- A/inherited_view/<%= @a %>/js
@@ -1 +0,0 @@
1
- A/view_with_locals/<%= @a %>/<%= name %>
@@ -1 +0,0 @@
1
- A/view_with_render_call/<%= @a %>:<%= render :view => :existing_view %>
@@ -1 +0,0 @@
1
- B/existing_view/<%= @b %>
@@ -1 +0,0 @@
1
- B/existing_view/<%= @b %>/js
@@ -1 +0,0 @@
1
- B-Metal:<%= @content_for_layout %>
@@ -1 +0,0 @@
1
- B/view_with_render_call/<%= @a %>:<%= render :view => :inherited_view %>
@@ -1,3 +0,0 @@
1
- <% @chords.each do |chord| %>
2
- <%= render :state => :play %>
3
- <% end %>
@@ -1 +0,0 @@
1
- <p id="renamedInstanceView" />
@@ -1 +0,0 @@
1
- <p id="superStateView"><%= @my_class %></p>
@@ -1,20 +0,0 @@
1
- # encoding: utf-8
2
-
3
- class CellsTestOneCell < ::Cell::Base
4
- def super_state
5
- @my_class = self.class.to_s
6
- return
7
- end
8
-
9
- def instance_view
10
- end
11
-
12
- def view_for_state(state)
13
- if state.to_s == 'instance_view'
14
- return 'cells_test_one/renamed_instance_view'
15
- end
16
- end
17
-
18
- def state_with_no_view
19
- end
20
- end
@@ -1,4 +0,0 @@
1
- # encoding: utf-8
2
-
3
- class CellsTestTwoCell < CellsTestOneCell
4
- end
@@ -1,3 +0,0 @@
1
- <p id="stateUsingApplicationHelper">
2
- <%= application_helper_method %>
3
- </p>
@@ -1,3 +0,0 @@
1
- <p id="stateWithAutomaticHelperInvocation">
2
- <%= an_automatically_included_helper_method %>
3
- </p>
@@ -1,3 +0,0 @@
1
- <p id="stateWithHelperInvocation">
2
- <%= a_mysterious_helper_method %>
3
- </p>
@@ -1,3 +0,0 @@
1
- <p id="stateWithHelperMethodInvocation">
2
- <%= my_helper_method %>
3
- </p>
@@ -1 +0,0 @@
1
- Metal:<%= @content_for_layout %>
@@ -1 +0,0 @@
1
- <div id="childHello"><%= @message %></div>
@@ -1 +0,0 @@
1
- <div id="motherBye"><%= @message %></div>
@@ -1 +0,0 @@
1
- <div id="motherHello"><%= @message %></div>
@@ -1 +0,0 @@
1
- <%= broken_assignment %>
@@ -1 +0,0 @@
1
- <div id="partial" />
@@ -1,3 +0,0 @@
1
- <div id="linkTo">
2
- <%= link_to :bla %>
3
- </div>
@@ -1,8 +0,0 @@
1
- <!-- this cell state utilizes a helper method that is NOT included in the cell. -->
2
-
3
- <p id="stateWithNotIncludedHelperMethod">
4
- <%= a_mysterious_helper_method %>
5
- </p>
6
-
7
-
8
- <%= form_tag "test" %>
@@ -1,3 +0,0 @@
1
- <div id="partialContained">
2
- <%= render :partial => "my_test/broken_partial" %>
3
- </div>
@@ -1,3 +0,0 @@
1
- <div id="partialContained">
2
- <%= render :partial => "my_test/nonexistant_partial" %>
3
- </div>
@@ -1,3 +0,0 @@
1
- <div id="partialContained">
2
- <%= render :partial => "my_test/partial" %>
3
- </div>
@@ -1,3 +0,0 @@
1
- <div id="partialContained">
2
- <%= render :partial => "partial" %>
3
- </div>
@@ -1 +0,0 @@
1
- <div id="localView" />
@@ -1 +0,0 @@
1
- <div id="explicitEnglishTranslation" />
@@ -1 +0,0 @@
1
- <div id="defaultTranslation" />
@@ -1,4 +0,0 @@
1
- <div id="view_with_instance_var">
2
- <div id="one"><%= @instance_variable_one %></div>
3
- <div id="two"><%= @instance_variable_two %></div>
4
- </div>
@@ -1 +0,0 @@
1
- <div id="happyStateView"></div>
@@ -1,11 +0,0 @@
1
- module NestedCell; end
2
-
3
-
4
- module ReallyModule
5
-
6
- class NestedCell < ::Cell::Base
7
- def happy_state
8
- end
9
- end
10
-
11
- end
@@ -1 +0,0 @@
1
- Written using my own spiffy templating system
@@ -1,7 +0,0 @@
1
- # encoding: utf-8
2
-
3
- class SimpleCell < ::Cell::Base
4
- def two_templates_state
5
- render
6
- end
7
- end
@@ -1 +0,0 @@
1
- <h1>beep!</h1>
@@ -1,7 +0,0 @@
1
- <h1>
2
- <% @captured_block = global_capture :captured_block do %>
3
- <%= "captured!" %>
4
- <% end %>
5
- </h1>
6
-
7
- <h2><%= @captured_block %></h2>
@@ -1,7 +0,0 @@
1
- <js>
2
- <% global_content_for :js do %>
3
- <%= "first line" %>
4
- <% end %>
5
- </js>
6
-
7
- <%= render :view => :state_invoking_content_for_twice %>
@@ -1,9 +0,0 @@
1
- <js>
2
- <% global_content_for :js do %>
3
- <%= "second line" %>
4
- <% end %>
5
-
6
- <% global_content_for :js do %>
7
- <%= "third line" %>
8
- <% end %>
9
- </js>
@@ -1,8 +0,0 @@
1
- <!-- this cell state utilizes a helper method that is NOT included in the cell. -->
2
-
3
- <p id="stateWithNotIncludedHelperMethod">
4
- <%= a_mysterious_helper_method %>
5
- </p>
6
-
7
-
8
- <%= form_tag "test" %>
@@ -1,3 +0,0 @@
1
- <p id="stateUsingAnotherHelper">
2
- <%= senseless_helper_method %>
3
- </p>
@@ -1,23 +0,0 @@
1
- # encoding: utf-8
2
- require File.join(File.dirname(__FILE__), 'test_helper')
3
-
4
- class MyTestCell < ::Cell::Base
5
- def state_with_instance_var
6
- @my_ivar = 'value from cell'
7
- render
8
- end
9
- end
10
-
11
- class BugsTest < ActionController::TestCase
12
- def test_controller_overriding_cell_ivars
13
- @controller.class_eval do
14
- attr_accessor :my_ivar
15
- end
16
- @controller.my_ivar = 'value from controller'
17
-
18
- cell = MyTestCell.new(@controller)
19
- c = cell.render_state(:state_with_instance_var)
20
-
21
- assert_equal 'value from cell', c
22
- end
23
- end
@@ -1,270 +0,0 @@
1
- # encoding: utf-8
2
- require File.join(File.dirname(__FILE__), *%w[test_helper])
3
-
4
- class CachingCell < ::Cell::Base
5
- cache :cached_state
6
-
7
- def cached_state
8
- count = controller.session[:cache_count]
9
- count ||= 0
10
- count += 1
11
- "#{count} should remain the same forever!"
12
- end
13
-
14
- def not_cached_state
15
- "i'm really static"
16
- end
17
-
18
- cache :versioned_cached_state, Proc.new { |cell|
19
- if (v = cell.session[:version]) > 0
20
- {:version => v}
21
- else
22
- {:version => 0}
23
- end
24
- }
25
- def versioned_cached_state
26
- "#{session[:version].inspect} should change every third call!"
27
- end
28
-
29
- def my_version_proc
30
- if (v = session[:version]) > 0
31
- {:version => v}
32
- else
33
- {:version => 0}
34
- end
35
- end
36
-
37
- # def cached_state_with_symbol_proc
38
- # end
39
-
40
- cache :cheers
41
- def cheers
42
- 'cheers!'
43
- end
44
-
45
- cache :another_state
46
- def another_state
47
- @opts[:str]
48
- end
49
- end
50
-
51
- class AnotherCachingCell < ::Cell::Base
52
- cache :cheers
53
- def cheers
54
- 'prost!'
55
- end
56
-
57
- def another_state
58
- @opts[:str]
59
- end
60
- end
61
-
62
- class CachingTest < ActiveSupport::TestCase
63
- def setup
64
- super
65
- @controller.session = {}
66
- @cc = CachingCell.new(@controller)
67
- @c2 = AnotherCachingCell.new(@controller)
68
-
69
- @old_action_controller_cache_store = ::ActionController::Base.cache_store
70
- @old_action_controller_perform_caching = ::ActionController::Base.perform_caching
71
- ::ActionController::Base.cache_store = :memory_store
72
- ::ActionController::Base.perform_caching = true
73
-
74
- ### FIXME: sorry for that, but we need to force caching. avoid #alias_method_chain.
75
- Cell::Base.alias_method_chain :render_state, :caching unless Cell::Base.method_defined? :render_state_without_caching
76
- end
77
-
78
- def teardown
79
- ::ActionController::Base.cache_store = @old_action_controller_cache_store
80
- ::ActionController::Base.perform_caching = @old_action_controller_perform_caching
81
- end
82
-
83
- def test_state_cached?
84
- assert @cc.state_cached?(:cached_state)
85
- assert_not @cc.state_cached?(:not_cached_state)
86
- end
87
-
88
- def test_cache_without_options
89
- # :cached_state is cached without any options:
90
- assert_nil @cc.version_procs[:cached_state]
91
- assert_nil @cc.version_procs[:not_cached_state]
92
-
93
- # cache_options must at least return an empty hash for a cached state:
94
- assert_equal ({}), @cc.cache_options[:cached_state]
95
- assert_nil @cc.cache_options[:not_cached_state]
96
- end
97
-
98
- def test_cache_with_proc_only
99
- CachingCell.class_eval do
100
- cache :my_state, Proc.new {}
101
- end
102
-
103
- assert_kind_of Proc, @cc.version_procs[:my_state]
104
- assert_equal ({}), @cc.cache_options[:my_state]
105
- end
106
-
107
- def test_cache_with_proc_and_cache_options
108
- CachingCell.class_eval do
109
- cache :my_state, Proc.new{}, {:expires_in => 10.seconds}
110
- end
111
-
112
- assert_kind_of Proc, @cc.version_procs[:my_state]
113
- assert_equal ({:expires_in => 10.seconds}), @cc.cache_options[:my_state]
114
- end
115
-
116
- def test_cache_with_cache_options_only
117
- CachingCell.class_eval do
118
- cache :my_state, :expires_in => 10.seconds
119
- end
120
-
121
- assert @cc.version_procs.has_key?(:my_state)
122
- assert_nil @cc.version_procs[:my_state]
123
- assert_equal ({:expires_in => 10.seconds}), @cc.cache_options[:my_state]
124
- end
125
-
126
- def test_if_caching_works
127
- c = @cc.render_state(:cached_state)
128
- assert_equal "1 should remain the same forever!", c
129
-
130
- c = @cc.render_state(:cached_state)
131
- assert_equal "1 should remain the same forever!", c, ":cached_state was invoked again"
132
- end
133
-
134
- def test_cache_key
135
- assert_equal "cells/caching/some_state", @cc.cache_key(:some_state)
136
- assert_equal @cc.cache_key(:some_state), ::Cell::Base.cache_key_for(:caching, :some_state)
137
- assert_equal "cells/caching/some_state/param=9", @cc.cache_key(:some_state, :param => 9)
138
- assert_equal "cells/caching/some_state/a=1/b=2", @cc.cache_key(:some_state, :b => 2, :a => 1)
139
- end
140
-
141
- def test_render_state_without_caching
142
- c = @cc.render_state(:not_cached_state)
143
- assert_equal "i'm really static", c
144
-
145
- c = @cc.render_state(:not_cached_state)
146
- assert_equal "i'm really static", c
147
- end
148
-
149
- def test_caching_with_version_proc
150
- @controller.session[:version] = 0
151
- # render state, as it's not cached:
152
- c = @cc.render_state(:versioned_cached_state)
153
- assert_equal '0 should change every third call!', c
154
-
155
- @controller.session[:version] = -1
156
- c = @cc.render_state(:versioned_cached_state)
157
- assert_equal '0 should change every third call!', c
158
-
159
- @controller.session[:version] = 1
160
- c = @cc.render_state(:versioned_cached_state)
161
- assert_equal '1 should change every third call!', c
162
-
163
- @controller.session[:version] = 2
164
- c = @cc.render_state(:versioned_cached_state)
165
- assert_equal '2 should change every third call!', c
166
-
167
- @controller.session[:version] = 3
168
- c = @cc.render_state(:versioned_cached_state)
169
- assert_equal '3 should change every third call!', c
170
- end
171
-
172
- def test_caching_with_instance_version_proc
173
- CachingCell.class_eval do
174
- cache :versioned_cached_state, :my_version_proc
175
- end
176
-
177
- @controller.session[:version] = 0
178
- c = @cc.render_state(:versioned_cached_state)
179
- assert_equal '0 should change every third call!', c
180
-
181
- @controller.session[:version] = 1
182
- c = @cc.render_state(:versioned_cached_state)
183
- assert_equal '1 should change every third call!', c
184
- end
185
-
186
- def test_caching_with_two_same_named_states
187
- c = @cc.render_state(:cheers)
188
- assert_equal 'cheers!', c
189
-
190
- c = @c2.render_state(:cheers)
191
- assert_equal 'prost!', c
192
-
193
- c = @cc.render_state(:cheers)
194
- assert_equal 'cheers!', c
195
-
196
- c = @c2.render_state(:cheers)
197
- assert_equal 'prost!', c
198
- end
199
-
200
- def test_caching_one_of_two_same_named_states
201
- ### DISCUSS with drogus: the problem was that CachingCell and AnotherCachingCell keep
202
- ### overwriting their version_procs, wasn't it? why don't we test that with different
203
- ### version_procs in each cell?
204
- @cc = CachingCell.new(@controller, :str => 'foo1')
205
- c = @cc.render_state(:another_state)
206
- assert_equal 'foo1',c
207
-
208
- @c2 = AnotherCachingCell.new(@controller, :str => 'foo2')
209
- c = @c2.render_state(:another_state)
210
- assert_equal 'foo2', c
211
-
212
- @cc = CachingCell.new(@controller, :str => 'bar1')
213
- c = @cc.render_state(:another_state)
214
- assert_equal 'foo1', c
215
-
216
- @c2 = AnotherCachingCell.new(@controller, :str => 'bar2')
217
- c = @c2.render_state(:another_state)
218
- assert_equal 'bar2', c
219
- end
220
-
221
- def test_expire_cache_key
222
- key = @cc.cache_key(:cached_state)
223
- @cc.render_state(:cached_state)
224
- assert ::Cell::Base.cache_store.read(key)
225
-
226
- ::Cell::Base.expire_cache_key(key)
227
- assert_not ::Cell::Base.cache_store.read(key)
228
-
229
- # test via ActionController::expire_cell_state, which is called from Sweepers.
230
- @cc.render_state(:cached_state)
231
- assert ::Cell::Base.cache_store.read(key)
232
-
233
- @controller.expire_cell_state(:caching, :cached_state)
234
- assert_not ::Cell::Base.cache_store.read(key)
235
-
236
- # ..and additionally test if passing cache key args works:
237
- key = @cc.cache_key(:cached_state, :more => :yes)
238
- assert ::Cell::Base.cache_store.write(key, 'test content')
239
-
240
- @controller.expire_cell_state(:caching, :cached_state, :more => :yes)
241
- assert_not ::Cell::Base.cache_store.read(key)
242
- end
243
-
244
- def test_find_family_view_for_state_with_caching
245
- # test environment: --------------------------------------
246
- assert_equal ({}), ACell.state2view_cache
247
-
248
- cell = ACell.new(@controller)
249
- cell.class.instance_eval do
250
- def cache_configured?
251
- false
252
- end
253
- end
254
- cell.render_state :existing_view
255
- # in development/test environment, no view name caching should happen,
256
- # if perform_caching is false.
257
- assert_equal ({}), ACell.state2view_cache
258
-
259
- # production environment: --------------------------------
260
- cell = ACell.new(@controller)
261
- cell.class.instance_eval do
262
- def cache_configured?
263
- true
264
- end
265
- end
266
-
267
- cell.render_state :existing_view
268
- assert ACell.state2view_cache.has_key?("existing_view/html")
269
- end
270
- end