cells 3.10.1 → 3.11.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.
- data/.travis.yml +7 -0
- data/CHANGES.md +18 -0
- data/Gemfile +1 -1
- data/README.md +182 -57
- data/TODO.md +9 -0
- data/cells.gemspec +3 -1
- data/gemfiles/Gemfile.rails4-0 +2 -1
- data/gemfiles/Gemfile.rails4-1 +5 -3
- data/lib/cell/base.rb +33 -64
- data/lib/cell/base/prefixes.rb +27 -0
- data/lib/cell/base/self_contained.rb +13 -0
- data/lib/cell/base/view.rb +15 -0
- data/lib/cell/builder.rb +52 -53
- data/lib/cell/caching.rb +21 -4
- data/lib/cell/concept.rb +85 -0
- data/lib/cell/rails.rb +13 -6
- data/lib/cell/rails/view_model.rb +47 -6
- data/lib/cell/rendering.rb +13 -13
- data/lib/cell/test_case.rb +3 -3
- data/lib/cell/view_model.rb +151 -0
- data/lib/cells.rb +0 -60
- data/lib/cells/rails.rb +10 -5
- data/lib/cells/railtie.rb +2 -5
- data/lib/cells/version.rb +1 -1
- data/lib/generators/erb/concept_generator.rb +17 -0
- data/lib/generators/haml/concept_generator.rb +17 -0
- data/lib/generators/rails/concept_generator.rb +16 -0
- data/lib/generators/templates/concept/cell.rb +9 -0
- data/lib/generators/templates/concept/view.erb +7 -0
- data/lib/generators/templates/concept/view.haml +4 -0
- data/lib/generators/trailblazer/base.rb +21 -0
- data/lib/generators/trailblazer/view_generator.rb +18 -0
- data/test/app/cells/bassist_cell.rb +1 -1
- data/test/app/cells/record/views/layout.haml +2 -0
- data/test/app/cells/record/views/show.erb +1 -0
- data/test/app/cells/record/views/song.erb +1 -0
- data/test/app/cells/song/scale.haml +1 -0
- data/test/cell_module_test.rb +18 -37
- data/test/cells_module_test.rb +1 -1
- data/test/concept_generator_test.rb +26 -0
- data/test/concept_test.rb +78 -0
- data/test/dummy/Rakefile +1 -1
- data/test/dummy/app/assets/javascripts/application.js +2 -0
- data/test/dummy/app/cells/album/assets/album.js +1 -0
- data/test/dummy/app/concepts/song/assets/songs.js +1 -0
- data/test/dummy/config/application.rb +11 -6
- data/test/dummy/label/label.gemspec +2 -2
- data/test/helper_test.rb +2 -2
- data/test/prefixes_test.rb +75 -0
- data/test/rails/asset_pipeline_test.rb +20 -0
- data/test/rails/caching_test.rb +1 -9
- data/test/rails/cells_test.rb +2 -17
- data/test/rails/forms_test.rb +2 -1
- data/test/rails/integration_test.rb +199 -8
- data/test/rails/render_test.rb +2 -10
- data/test/rails/view_model_test.rb +135 -60
- data/test/rails_helper_api_test.rb +2 -1
- data/test/self_contained_test.rb +9 -2
- data/test/test_case_test.rb +2 -2
- data/test/test_helper.rb +2 -3
- metadata +117 -33
- checksums.yaml +0 -7
- data/test/dummy/app/controllers/musician_controller.rb +0 -36
- data/test/rails/router_test.rb +0 -45
@@ -0,0 +1 @@
|
|
1
|
+
Party on, <%= model %>!
|
@@ -0,0 +1 @@
|
|
1
|
+
Lalala
|
@@ -0,0 +1 @@
|
|
1
|
+
A Minor!
|
data/test/cell_module_test.rb
CHANGED
@@ -61,7 +61,7 @@ class CellModuleTest < MiniTest::Spec
|
|
61
61
|
end
|
62
62
|
end
|
63
63
|
|
64
|
-
describe "
|
64
|
+
describe "cell_for" do
|
65
65
|
it "call the cell's builders, eventually returning a different class" do
|
66
66
|
class DrummerCell < BassistCell
|
67
67
|
build do
|
@@ -69,11 +69,11 @@ class CellModuleTest < MiniTest::Spec
|
|
69
69
|
end
|
70
70
|
end
|
71
71
|
|
72
|
-
assert_instance_of BassistCell, Cell::Rails.
|
72
|
+
assert_instance_of BassistCell, Cell::Rails.cell_for("cell_module_test/drummer", :play, @controller)
|
73
73
|
end
|
74
74
|
end
|
75
75
|
|
76
|
-
describe "#
|
76
|
+
describe "#cell_for with #build" do
|
77
77
|
before do
|
78
78
|
@controller.class_eval do
|
79
79
|
attr_accessor :bassist
|
@@ -95,13 +95,13 @@ class CellModuleTest < MiniTest::Spec
|
|
95
95
|
|
96
96
|
it "execute the block in controller describe" do
|
97
97
|
@controller.bassist = true
|
98
|
-
assert_is_a BassistCell, Cell::Rails.
|
98
|
+
assert_is_a BassistCell, Cell::Rails.cell_for(:musician, @controller)
|
99
99
|
end
|
100
100
|
|
101
101
|
it "limit the builder to the receiving class" do
|
102
|
-
assert_is_a PianistCell, Cell::Rails.
|
102
|
+
assert_is_a PianistCell, Cell::Rails.cell_for(:pianist, @controller) # don't inherit anything.
|
103
103
|
@controller.bassist = true
|
104
|
-
assert_is_a BassistCell, Cell::Rails.
|
104
|
+
assert_is_a BassistCell, Cell::Rails.cell_for(:musician, @controller)
|
105
105
|
end
|
106
106
|
|
107
107
|
it "chain build blocks and execute them by ORing them in the same order" do
|
@@ -113,13 +113,13 @@ class CellModuleTest < MiniTest::Spec
|
|
113
113
|
UnknownCell # it never be executed.
|
114
114
|
end
|
115
115
|
|
116
|
-
assert_is_a PianistCell, Cell::Rails.
|
116
|
+
assert_is_a PianistCell, Cell::Rails.cell_for(:musician, @controller) # bassist is false.
|
117
117
|
@controller.bassist = true
|
118
|
-
assert_is_a BassistCell, Cell::Rails.
|
118
|
+
assert_is_a BassistCell, Cell::Rails.cell_for(:musician, @controller)
|
119
119
|
end
|
120
120
|
|
121
121
|
it "use the original cell if no builder matches" do
|
122
|
-
assert_is_a MusicianCell, Cell::Rails.
|
122
|
+
assert_is_a MusicianCell, Cell::Rails.cell_for(:musician, @controller) # bassist is false.
|
123
123
|
end
|
124
124
|
|
125
125
|
it "stop at the first builder returning a valid cell" do
|
@@ -130,12 +130,12 @@ class CellModuleTest < MiniTest::Spec
|
|
130
130
|
BassistCell.build do |opts|
|
131
131
|
SingerCell if opts[:sing_the_song]
|
132
132
|
end
|
133
|
-
assert_kind_of BassistCell, Cell::Rails.
|
134
|
-
assert_kind_of SingerCell, Cell::Rails.
|
133
|
+
assert_kind_of BassistCell, Cell::Rails.cell_for(:bassist, @controller, {})
|
134
|
+
assert_kind_of SingerCell, Cell::Rails.cell_for(:bassist, @controller, {:sing_the_song => true})
|
135
135
|
end
|
136
136
|
|
137
137
|
it "create the original target class if no block matches" do
|
138
|
-
assert_kind_of PianistCell, Cell::Rails.
|
138
|
+
assert_kind_of PianistCell, Cell::Rails.cell_for(:pianist, @controller)
|
139
139
|
end
|
140
140
|
|
141
141
|
it "builders it return an empty array per default" do
|
@@ -143,11 +143,14 @@ class CellModuleTest < MiniTest::Spec
|
|
143
143
|
end
|
144
144
|
end
|
145
145
|
|
146
|
-
|
147
|
-
|
146
|
+
include ActiveSupport::Testing::Deprecation
|
147
|
+
it "deprecates class_from_cell_name" do
|
148
|
+
# assert_deprecated do
|
149
|
+
assert_equal BassistCell, ::Cell::Rails.send(:class_from_cell_name, 'bassist')
|
150
|
+
# end
|
148
151
|
end
|
149
152
|
|
150
|
-
if Cell.
|
153
|
+
if Cell.rails_version.~("3.0")
|
151
154
|
it "provide possible_paths_for_state" do
|
152
155
|
assert_equal ["bad_guitarist/play", "bassist/play"], cell(:bad_guitarist).send(:possible_paths_for_state, :play)
|
153
156
|
end
|
@@ -164,26 +167,4 @@ class CellModuleTest < MiniTest::Spec
|
|
164
167
|
end
|
165
168
|
end
|
166
169
|
end
|
167
|
-
|
168
|
-
it "respond to #rails3_1_or_more?" do
|
169
|
-
if Rails::VERSION::MAJOR == 3
|
170
|
-
if Rails::VERSION::MINOR == 0
|
171
|
-
assert ! Cell.rails3_1_or_more?
|
172
|
-
assert Cell.rails3_0?
|
173
|
-
elsif Rails::VERSION::MINOR == 1
|
174
|
-
assert Cell.rails3_1_or_more?
|
175
|
-
assert ! Cell.rails3_0?
|
176
|
-
elsif Rails::VERSION::MINOR == 2
|
177
|
-
assert Cell.rails3_1_or_more?
|
178
|
-
assert ! Cell.rails3_0?
|
179
|
-
end
|
180
|
-
elsif Rails::VERSION::MAJOR == 4
|
181
|
-
if Rails::VERSION::MINOR == 0
|
182
|
-
assert ! Cell.rails3_1_or_more?
|
183
|
-
assert Cell.rails4_0?
|
184
|
-
elsif Rails::VERSION::MINOR == 1
|
185
|
-
assert Cell.rails4_1?
|
186
|
-
end
|
187
|
-
end
|
188
|
-
end
|
189
170
|
end
|
data/test/cells_module_test.rb
CHANGED
@@ -16,7 +16,7 @@ class CellsModuleTest < MiniTest::Spec
|
|
16
16
|
c.append_view_path "/road/to/nowhere"
|
17
17
|
end
|
18
18
|
|
19
|
-
if Cell.
|
19
|
+
if Cell.rails_version >= ("3.2")
|
20
20
|
assert_equal "/road/to/nowhere", Cell::Rails.view_paths.paths.last.to_s
|
21
21
|
else
|
22
22
|
assert_equal "/road/to/nowhere", Cell::Rails.view_paths.last.to_s
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
require 'generators/rails/concept_generator'
|
3
|
+
|
4
|
+
class ConceptGeneratorTest < Rails::Generators::TestCase
|
5
|
+
destination File.join(Rails.root, "tmp")
|
6
|
+
setup :prepare_destination
|
7
|
+
tests ::Rails::Generators::ConceptGenerator
|
8
|
+
|
9
|
+
test "[erb] standard assets, show view" do
|
10
|
+
run_generator %w(Song)
|
11
|
+
|
12
|
+
assert_file "app/concepts/song/cell.rb", /class Song::Cell < Cell::Rails/
|
13
|
+
assert_file "app/concepts/song/cell.rb", /include Concept/
|
14
|
+
assert_file "app/concepts/song/cell.rb", /def show/
|
15
|
+
assert_file "app/concepts/song/views/show.erb", %r(app/concepts/song/views/show\.erb)
|
16
|
+
end
|
17
|
+
|
18
|
+
test "[haml] standard assets, show view" do
|
19
|
+
run_generator %w(Song -e haml)
|
20
|
+
|
21
|
+
assert_file "app/concepts/song/cell.rb", /class Song::Cell < Cell::Rails/
|
22
|
+
assert_file "app/concepts/song/cell.rb", /include Concept/
|
23
|
+
assert_file "app/concepts/song/cell.rb", /def show/
|
24
|
+
assert_file "app/concepts/song/views/show.haml", %r(app/concepts/song/views/show\.haml)
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,78 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
if Cell.rails_version >= 3.1
|
4
|
+
# Trailblazer style:
|
5
|
+
module Record
|
6
|
+
class Cell < Cell::Concept # cell("record")
|
7
|
+
def show
|
8
|
+
render # Party On, #{model}
|
9
|
+
end
|
10
|
+
|
11
|
+
# cell(:song, concept: :record)
|
12
|
+
class Song < self # cell("record/cell/song")
|
13
|
+
def show
|
14
|
+
render :view => :song#, :layout => "layout"
|
15
|
+
# TODO: test layout: .. in ViewModel
|
16
|
+
end
|
17
|
+
|
18
|
+
def show_with_layout
|
19
|
+
render :view => :song, :layout => "layout"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
class Hit < ::Cell::Concept
|
24
|
+
inherit_views Record::Cell
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
# app/cells/comment/views
|
30
|
+
# app/cells/comment/form/views
|
31
|
+
# app/cells/comment/views/form inherit_views Comment::Cell, render form/show
|
32
|
+
|
33
|
+
|
34
|
+
class ConceptTest < MiniTest::Spec
|
35
|
+
include Cell::TestCase::TestMethods
|
36
|
+
|
37
|
+
|
38
|
+
describe "::controller_path" do
|
39
|
+
it { Record::Cell.new(@controller).controller_path.must_equal "record" }
|
40
|
+
it { Record::Cell::Song.new(@controller).controller_path.must_equal "record/song" }
|
41
|
+
end
|
42
|
+
|
43
|
+
|
44
|
+
describe "#_prefixes" do
|
45
|
+
it { Record::Cell.new(@controller)._prefixes.must_equal ["record/views"] }
|
46
|
+
it { Record::Cell::Song.new(@controller)._prefixes.must_equal ["record/song/views", "record/views"] }
|
47
|
+
it { Record::Cell::Hit.new(@controller)._prefixes.must_equal ["record/hit/views", "record/views"] } # with inherit_views.
|
48
|
+
end
|
49
|
+
|
50
|
+
unless ::Cell.rails_version.~("3.0")
|
51
|
+
it { Record::Cell.new(@controller, "Wayne").render_state(:show).must_equal "Party on, Wayne!" }
|
52
|
+
end
|
53
|
+
|
54
|
+
|
55
|
+
describe "#cell" do
|
56
|
+
it { Cell::Concept.cell("record/cell", @controller).must_be_instance_of( Record::Cell) }
|
57
|
+
it { Cell::Concept.cell("record/cell/song", @controller).must_be_instance_of Record::Cell::Song }
|
58
|
+
# cell("song", concept: "record/compilation") # record/compilation/cell/song
|
59
|
+
end
|
60
|
+
|
61
|
+
|
62
|
+
describe "#render with :layout" do
|
63
|
+
it { Cell::Concept.cell("record/cell/song", @controller).show_with_layout.must_equal "<p>\nLalala\n</p>\n" }
|
64
|
+
end
|
65
|
+
describe "#render" do
|
66
|
+
it { Cell::Concept.cell("record/cell/song", @controller).show.must_equal "Lalala" }
|
67
|
+
end
|
68
|
+
|
69
|
+
|
70
|
+
# inheriting
|
71
|
+
it "inherit play.html.erb from BassistCell" do
|
72
|
+
BadGuitaristCell.class_eval do
|
73
|
+
def play; render; end
|
74
|
+
end
|
75
|
+
assert_equal "Doo", render_cell(:bad_guitarist, :play)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
data/test/dummy/Rakefile
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
var Album = {};
|
@@ -0,0 +1 @@
|
|
1
|
+
var Songs = [];
|
@@ -4,12 +4,8 @@ require "active_model/railtie"
|
|
4
4
|
require "action_controller/railtie"
|
5
5
|
require "action_view/railtie"
|
6
6
|
|
7
|
-
Bundler.require
|
8
|
-
|
9
|
-
|
10
7
|
require "cells"
|
11
|
-
|
12
|
-
#require "rails_app"
|
8
|
+
require "sprockets/railtie" if Cell.rails_version >= "3.1"
|
13
9
|
|
14
10
|
module Dummy
|
15
11
|
class Application < Rails::Application
|
@@ -17,7 +13,16 @@ module Dummy
|
|
17
13
|
|
18
14
|
# Configure sensitive parameters which will be filtered from the log file.
|
19
15
|
config.filter_parameters += [:password]
|
20
|
-
|
16
|
+
|
21
17
|
config.cache_store = :memory_store
|
18
|
+
config.secret_token = "some secret phrase of at least 30 characters"
|
19
|
+
|
20
|
+
# enable asset pipeline as in development.
|
21
|
+
if Cell.rails_version >= "3.1"
|
22
|
+
config.assets.enabled = true
|
23
|
+
config.assets.compile = true
|
24
|
+
|
25
|
+
config.cells.with_assets = ["album", "song"]
|
26
|
+
end
|
22
27
|
end
|
23
28
|
end
|
@@ -7,8 +7,8 @@ require "label/version"
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "label"
|
9
9
|
s.version = Label::VERSION
|
10
|
-
s.authors = ["
|
11
|
-
s.email = ["
|
10
|
+
s.authors = ["Nick"]
|
11
|
+
s.email = ["apotonick@gmail.com"]
|
12
12
|
s.homepage = "TODO"
|
13
13
|
s.summary = "TODO: Summary of Label."
|
14
14
|
s.description = "TODO: Description of Label."
|
data/test/helper_test.rb
CHANGED
@@ -25,14 +25,14 @@ class HelperTest < MiniTest::Spec
|
|
25
25
|
include ActionView::Helpers::AssetTagHelper
|
26
26
|
|
27
27
|
def show
|
28
|
-
controller.config.relative_url_root = "" if Cell.
|
28
|
+
controller.config.relative_url_root = "" if Cell.rails_version.~("3.0")
|
29
29
|
image_tag("no-more-the-meek.jpg")
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
33
|
it "allows using helpers using #controller on instance level" do
|
34
34
|
alt = "No-more-the-meek"
|
35
|
-
alt = "No more the meek" if Cell.
|
35
|
+
alt = "No more the meek" if Cell.rails_version >= "4.0"
|
36
36
|
assert_equal "<img alt=\"#{alt}\" src=\"/images/no-more-the-meek.jpg\" />", render_cell("helper_test/song", :show)
|
37
37
|
end
|
38
38
|
end
|
@@ -0,0 +1,75 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class BassistCell::FenderCell < Cell::Rails
|
4
|
+
end
|
5
|
+
|
6
|
+
class BassistCell::IbanezCell < BassistCell
|
7
|
+
end
|
8
|
+
|
9
|
+
class PrefixesTest < MiniTest::Spec
|
10
|
+
include Cell::TestCase::TestMethods
|
11
|
+
|
12
|
+
class SingerCell < Cell::Base
|
13
|
+
end
|
14
|
+
|
15
|
+
class BackgroundVocalsCell < SingerCell
|
16
|
+
end
|
17
|
+
|
18
|
+
class ChorusCell < BackgroundVocalsCell
|
19
|
+
end
|
20
|
+
|
21
|
+
class GuitaristCell < SingerCell
|
22
|
+
def self._local_prefixes
|
23
|
+
["stringer"]
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
class BassistCell < SingerCell
|
28
|
+
def self._local_prefixes
|
29
|
+
super + ["basser"]
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
|
34
|
+
describe "::controller_path" do
|
35
|
+
it { ::BassistCell.new(@controller).controller_path.must_equal "bassist" }
|
36
|
+
it { SingerCell.new(@controller).controller_path.must_equal "prefixes_test/singer" }
|
37
|
+
end
|
38
|
+
|
39
|
+
describe "#_prefixes" do
|
40
|
+
it { ::BassistCell.new(@controller)._prefixes.must_equal ["bassist"] }
|
41
|
+
it { ::BassistCell::FenderCell.new(@controller)._prefixes.must_equal ["bassist_cell/fender"] }
|
42
|
+
it { ::BassistCell::IbanezCell.new(@controller)._prefixes.must_equal ["bassist_cell/ibanez", "bassist"] }
|
43
|
+
|
44
|
+
it { SingerCell.new(@controller)._prefixes.must_equal ["prefixes_test/singer"] }
|
45
|
+
it { BackgroundVocalsCell.new(@controller)._prefixes.must_equal ["prefixes_test/background_vocals", "prefixes_test/singer"] }
|
46
|
+
it { ChorusCell.new(@controller)._prefixes.must_equal ["prefixes_test/chorus", "prefixes_test/background_vocals", "prefixes_test/singer"] }
|
47
|
+
|
48
|
+
it { GuitaristCell.new(@controller)._prefixes.must_equal ["stringer", "prefixes_test/singer"] }
|
49
|
+
it { BassistCell.new(@controller)._prefixes.must_equal ["prefixes_test/bassist", "basser", "prefixes_test/singer"] }
|
50
|
+
# it { DrummerCell.new(@controller)._prefixes.must_equal ["drummer", "stringer", "prefixes_test/singer"] }
|
51
|
+
end
|
52
|
+
|
53
|
+
# it { Record::Cell.new(@controller).render_state(:show).must_equal "Rock on!" }
|
54
|
+
end
|
55
|
+
|
56
|
+
class InheritViewsTest < MiniTest::Spec
|
57
|
+
include Cell::TestCase::TestMethods
|
58
|
+
|
59
|
+
class SlapperCell < Cell::Rails
|
60
|
+
inherit_views ::BassistCell
|
61
|
+
|
62
|
+
def play
|
63
|
+
render
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
class FunkerCell < SlapperCell
|
68
|
+
end
|
69
|
+
|
70
|
+
unless ::Cell.rails_version.~("3.0")
|
71
|
+
# test if normal cells inherit views.
|
72
|
+
it { cell("inherit_views_test/slapper").render_state(:play).must_equal "Doo" }
|
73
|
+
it { cell("inherit_views_test/funker").render_state(:play).must_equal "Doo" }
|
74
|
+
end
|
75
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require "test_helper"
|
2
|
+
require "capybara/rails"
|
3
|
+
|
4
|
+
# This blog post helped so much: http://rakeroutes.com/blog/write-a-gem-for-the-rails-asset-pipeline/
|
5
|
+
# Thanks, Stephen!!! :)
|
6
|
+
|
7
|
+
if Cell.rails_version >= 3.1
|
8
|
+
|
9
|
+
class AssetPipelineTest < MiniTest::Spec
|
10
|
+
include Capybara::DSL
|
11
|
+
register_spec_type(/integration$/, self)
|
12
|
+
|
13
|
+
it "what" do
|
14
|
+
visit "assets/application.js"
|
15
|
+
page.text.must_include 'var Album = {};'
|
16
|
+
page.text.must_include 'var Songs = [];'
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
data/test/rails/caching_test.rb
CHANGED
@@ -38,7 +38,7 @@ class CachingUnitTest < MiniTest::Spec
|
|
38
38
|
end
|
39
39
|
|
40
40
|
it "accept hash as key parts" do
|
41
|
-
if Cell.
|
41
|
+
if Cell.rails_version >= ("4.0")
|
42
42
|
assert_equal "cells/director/count/b/2/a/1", @class.state_cache_key(:count, :b=>2, :a=>1)
|
43
43
|
else
|
44
44
|
assert_equal "cells/director/count/a=1&b=2", @class.state_cache_key(:count, :b=>2, :a=>1)
|
@@ -149,14 +149,6 @@ class CachingUnitTest < MiniTest::Spec
|
|
149
149
|
assert_equal "1", @class.cache_store.read(@key)
|
150
150
|
assert_not ::Cell::Rails.cache_store.read(key)
|
151
151
|
end
|
152
|
-
|
153
|
-
include ActiveSupport::Testing::Deprecation
|
154
|
-
it "raise a deprecation notice when passing in a :symbol" do
|
155
|
-
assert_deprecated do
|
156
|
-
MusicianController.new.expire_cell_state(:director, :tock)
|
157
|
-
end
|
158
|
-
assert_not @class.cache_store.read(@key)
|
159
|
-
end
|
160
152
|
end
|
161
153
|
end
|
162
154
|
|
data/test/rails/cells_test.rb
CHANGED
@@ -47,21 +47,6 @@ class RailsCellsTest < MiniTest::Spec
|
|
47
47
|
|
48
48
|
|
49
49
|
describe "A rails cell" do
|
50
|
-
it "respond to DEFAULT_VIEW_PATHS" do
|
51
|
-
assert_equal ["app/cells"], Cell::Rails::DEFAULT_VIEW_PATHS
|
52
|
-
end
|
53
|
-
|
54
|
-
it "respond to .setup_view_paths!" do
|
55
|
-
swap( Cell::Rails, :view_paths => []) do
|
56
|
-
Cell::Rails.setup_view_paths!
|
57
|
-
if Cell.rails3_2_or_more? or Cell.rails4_0? or Cell.rails4_1?
|
58
|
-
assert_equal ActionView::PathSet.new(Cell::Rails::DEFAULT_VIEW_PATHS).paths, Cell::Rails.view_paths.paths
|
59
|
-
else
|
60
|
-
assert_equal ActionView::PathSet.new(Cell::Rails::DEFAULT_VIEW_PATHS), Cell::Rails.view_paths
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
50
|
it "respond to view_paths" do
|
66
51
|
assert_kind_of ActionView::PathSet, Cell::Rails.view_paths, "must be a PathSet for proper template caching/reloading (see issue#2)"
|
67
52
|
end
|
@@ -81,7 +66,7 @@ class RailsCellsTest < MiniTest::Spec
|
|
81
66
|
end
|
82
67
|
|
83
68
|
|
84
|
-
if Cell.
|
69
|
+
if Cell.rails_version.~("3.0")
|
85
70
|
describe "invoking find_family_view_for_state" do
|
86
71
|
it "raise an error when a template is missing" do
|
87
72
|
assert_raises ActionView::MissingTemplate do
|
@@ -118,7 +103,7 @@ class RailsCellsTest < MiniTest::Spec
|
|
118
103
|
|
119
104
|
it "respond to session" do
|
120
105
|
session_kind = Hash
|
121
|
-
session_kind = ActionController::TestSession if Cell.
|
106
|
+
session_kind = ActionController::TestSession if Cell.rails_version >= ("4.0")
|
122
107
|
assert_kind_of session_kind, @cell.session
|
123
108
|
end
|
124
109
|
|