cells 3.8.6 → 3.8.7
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES.textile +4 -0
- data/Gemfile +1 -1
- data/README.rdoc +2 -2
- data/cells.gemspec +2 -3
- data/lib/cell/base.rb +8 -3
- data/lib/cell/rails.rb +1 -0
- data/lib/cell/rails3_0_strategy.rb +10 -8
- data/lib/cell/rails3_1_strategy.rb +10 -8
- data/lib/cell/test_case.rb +1 -1
- data/lib/cells/engines.rb +0 -2
- data/lib/cells/version.rb +1 -1
- data/test/cell_generator_test.rb +102 -104
- data/test/cell_module_test.rb +37 -33
- data/test/cells_module_test.rb +7 -7
- data/test/deprecations_test.rb +14 -14
- data/test/dummy/config/environments/test.rb +1 -0
- data/test/dummy/config/routes.rb +1 -1
- data/test/helper_test.rb +23 -7
- data/test/rails/caching_test.rb +102 -82
- data/test/rails/capture_test.rb +30 -11
- data/test/rails/cells_test.rb +24 -23
- data/test/rails/integration_test.rb +9 -9
- data/test/rails/render_test.rb +30 -26
- data/test/rails/router_test.rb +6 -6
- data/test/rails/view_test.rb +9 -9
- data/test/rails_helper_api_test.rb +1 -1
- data/test/test_case_test.rb +30 -30
- data/test/test_helper.rb +1 -3
- metadata +6 -29
- data/lib/cell.rb +0 -2
- data/test/dummy/public/javascripts/application.js +0 -2
- data/test/dummy/public/javascripts/controls.js +0 -965
- data/test/dummy/public/javascripts/dragdrop.js +0 -974
- data/test/dummy/public/javascripts/effects.js +0 -1123
- data/test/dummy/public/javascripts/prototype.js +0 -4874
- data/test/dummy/public/javascripts/rails.js +0 -118
data/CHANGES.textile
CHANGED
data/Gemfile
CHANGED
data/README.rdoc
CHANGED
@@ -18,7 +18,7 @@ And the best: You can have as many cells in your page as you need!
|
|
18
18
|
|
19
19
|
It's a gem!
|
20
20
|
|
21
|
-
Rails 3.
|
21
|
+
Rails >= 3.0:
|
22
22
|
|
23
23
|
gem install cells
|
24
24
|
|
@@ -235,7 +235,7 @@ Your views can now use the gem's helpers.
|
|
235
235
|
<%= f.button :submit %>
|
236
236
|
<% end %>
|
237
237
|
|
238
|
-
Note that this currently "only" works with Rails 3.2.
|
238
|
+
Note that this currently "only" works with Rails 3.2-4.0.
|
239
239
|
|
240
240
|
== Cells is Rails::Engine aware!
|
241
241
|
|
data/cells.gemspec
CHANGED
@@ -19,11 +19,10 @@ Gem::Specification.new do |s|
|
|
19
19
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
20
|
s.require_paths = ["lib"]
|
21
21
|
|
22
|
-
s.add_dependency "actionpack", "
|
23
|
-
s.add_dependency "railties", "
|
22
|
+
s.add_dependency "actionpack", ">= 3.0"
|
23
|
+
s.add_dependency "railties", ">= 3.0"
|
24
24
|
|
25
25
|
s.add_development_dependency "rake"
|
26
|
-
s.add_development_dependency "shoulda"
|
27
26
|
s.add_development_dependency "haml"
|
28
27
|
s.add_development_dependency "slim"
|
29
28
|
s.add_development_dependency "simple_form"
|
data/lib/cell/base.rb
CHANGED
@@ -5,15 +5,19 @@ require 'cell/rendering'
|
|
5
5
|
|
6
6
|
module Cell
|
7
7
|
def self.rails3_0?
|
8
|
-
::ActionPack::VERSION::MINOR == 0
|
8
|
+
::ActionPack::VERSION::MAJOR == 3 and ::ActionPack::VERSION::MINOR == 0
|
9
9
|
end
|
10
10
|
|
11
11
|
def self.rails3_1_or_more?
|
12
|
-
::ActionPack::VERSION::MINOR >= 1
|
12
|
+
::ActionPack::VERSION::MAJOR == 3 and ::ActionPack::VERSION::MINOR >= 1
|
13
13
|
end
|
14
14
|
|
15
15
|
def self.rails3_2_or_more? # FIXME: move to tests.
|
16
|
-
::ActionPack::VERSION::MINOR >= 2
|
16
|
+
::ActionPack::VERSION::MAJOR == 3 and ::ActionPack::VERSION::MINOR >= 2
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.rails4_0_or_more? # FIXME: move to tests.
|
20
|
+
::ActionPack::VERSION::MAJOR == 4
|
17
21
|
end
|
18
22
|
|
19
23
|
|
@@ -27,6 +31,7 @@ module Cell
|
|
27
31
|
|
28
32
|
require 'cell/rails3_0_strategy' if Cell.rails3_0?
|
29
33
|
require 'cell/rails3_1_strategy' if Cell.rails3_1_or_more?
|
34
|
+
require 'cell/rails4_0_strategy' if Cell.rails4_0_or_more?
|
30
35
|
include VersionStrategy
|
31
36
|
include Rendering
|
32
37
|
include Caching
|
data/lib/cell/rails.rb
CHANGED
@@ -65,14 +65,16 @@ module Cell
|
|
65
65
|
end
|
66
66
|
|
67
67
|
|
68
|
-
module Cells
|
69
|
-
module
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
68
|
+
module Cells
|
69
|
+
module Engines
|
70
|
+
module VersionStrategy
|
71
|
+
def registered_engines
|
72
|
+
::Rails::Application.railties.engines
|
73
|
+
end
|
74
|
+
|
75
|
+
def existent_directories_for(path)
|
76
|
+
path.to_a.select { |d| File.directory?(d) }
|
77
|
+
end
|
76
78
|
end
|
77
79
|
end
|
78
80
|
end
|
@@ -23,14 +23,16 @@ module Cell
|
|
23
23
|
end
|
24
24
|
|
25
25
|
|
26
|
-
module Cells
|
27
|
-
module
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
path
|
26
|
+
module Cells
|
27
|
+
module Engines
|
28
|
+
module VersionStrategy
|
29
|
+
def registered_engines
|
30
|
+
::Rails::Application::Railties.engines
|
31
|
+
end
|
32
|
+
|
33
|
+
def existent_directories_for(path)
|
34
|
+
path.existent_directories
|
35
|
+
end
|
34
36
|
end
|
35
37
|
end
|
36
38
|
end
|
data/lib/cell/test_case.rb
CHANGED
data/lib/cells/engines.rb
CHANGED
data/lib/cells/version.rb
CHANGED
data/test/cell_generator_test.rb
CHANGED
@@ -6,110 +6,108 @@ class CellGeneratorTest < Rails::Generators::TestCase
|
|
6
6
|
setup :prepare_destination
|
7
7
|
tests ::Rails::Generators::CellGenerator
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
run_generator %w(Blog post latest)
|
12
|
-
|
13
|
-
assert_file "app/cells/blog_cell.rb", /class BlogCell < Cell::Rails/
|
14
|
-
assert_file "app/cells/blog_cell.rb", /def post/
|
15
|
-
assert_file "app/cells/blog_cell.rb", /def latest/
|
16
|
-
assert_file "app/cells/blog/post.html.erb", %r(app/cells/blog/post\.html\.erb)
|
17
|
-
assert_file "app/cells/blog/post.html.erb", %r(<p>)
|
18
|
-
assert_file "app/cells/blog/latest.html.erb", %r(app/cells/blog/latest\.html\.erb)
|
19
|
-
|
20
|
-
|
21
|
-
assert_no_file "app/cells/blog/post.html.haml"
|
22
|
-
assert_no_file "app/cells/blog/post.html.haml"
|
23
|
-
assert_no_file "app/cells/blog/latest.html.haml"
|
24
|
-
|
25
|
-
assert_no_file "app/cells/blog/post.html.slim"
|
26
|
-
assert_no_file "app/cells/blog/post.html.slim"
|
27
|
-
assert_no_file "app/cells/blog/latest.html.slim"
|
28
|
-
end
|
29
|
-
|
30
|
-
should "create cell that inherits from custom cell class if specified" do
|
31
|
-
run_generator %w(Blog --base-cell-class=ApplicationCell)
|
32
|
-
assert_file "app/cells/blog_cell.rb", /class BlogCell < ApplicationCell/
|
33
|
-
end
|
34
|
-
|
35
|
-
should "work with namespaces" do
|
36
|
-
run_generator %w(Blog::Post latest)
|
37
|
-
|
38
|
-
assert_file "app/cells/blog/post_cell.rb", /class Blog::PostCell < Cell::Rails/
|
39
|
-
assert_file "app/cells/blog/post_cell.rb", /def latest/
|
40
|
-
assert_file "app/cells/blog/post/latest.html.erb", %r(app/cells/blog/post/latest\.html\.erb)
|
41
|
-
end
|
42
|
-
|
43
|
-
should "work with namespaces and haml" do
|
44
|
-
run_generator %w(Blog::Post latest -e haml)
|
45
|
-
|
46
|
-
assert_file "app/cells/blog/post_cell.rb", /class Blog::PostCell < Cell::Rails/
|
47
|
-
assert_file "app/cells/blog/post/latest.html.haml", %r(app/cells/blog/post/latest\.html\.haml)
|
48
|
-
end
|
49
|
-
|
50
|
-
should "work with namespaces and slim" do
|
51
|
-
run_generator %w(Blog::Post latest -e slim)
|
52
|
-
|
53
|
-
assert_file "app/cells/blog/post_cell.rb", /class Blog::PostCell < Cell::Rails/
|
54
|
-
assert_file "app/cells/blog/post/latest.html.slim", %r(app/cells/blog/post/latest\.html\.slim)
|
55
|
-
end
|
56
|
-
|
57
|
-
should "create slim assets with -e slim" do
|
58
|
-
run_generator %w(Blog post latest -e slim)
|
59
|
-
|
60
|
-
assert_file "app/cells/blog_cell.rb", /class BlogCell < Cell::Rails/
|
61
|
-
assert_file "app/cells/blog_cell.rb", /def post/
|
62
|
-
assert_file "app/cells/blog_cell.rb", /def latest/
|
63
|
-
assert_file "app/cells/blog/post.html.slim", %r(app/cells/blog/post\.html\.slim)
|
64
|
-
assert_file "app/cells/blog/post.html.slim", %r(p)
|
65
|
-
assert_file "app/cells/blog/latest.html.slim", %r(app/cells/blog/latest\.html\.slim)
|
66
|
-
|
67
|
-
|
68
|
-
assert_no_file "app/cells/blog/post.html.erb"
|
69
|
-
assert_no_file "app/cells/blog/post.html.erb"
|
70
|
-
assert_no_file "app/cells/blog/latest.html.erb"
|
71
|
-
|
72
|
-
assert_no_file "app/cells/blog/post.html.haml"
|
73
|
-
assert_no_file "app/cells/blog/post.html.haml"
|
74
|
-
assert_no_file "app/cells/blog/latest.html.haml"
|
75
|
-
end
|
76
|
-
|
77
|
-
should "create haml assets with -e haml" do
|
78
|
-
run_generator %w(Blog post latest -e haml)
|
79
|
-
|
80
|
-
assert_file "app/cells/blog_cell.rb", /class BlogCell < Cell::Rails/
|
81
|
-
assert_file "app/cells/blog_cell.rb", /def post/
|
82
|
-
assert_file "app/cells/blog_cell.rb", /def latest/
|
83
|
-
assert_file "app/cells/blog/post.html.haml", %r(app/cells/blog/post\.html\.haml)
|
84
|
-
assert_file "app/cells/blog/post.html.haml", %r(%p)
|
85
|
-
assert_file "app/cells/blog/latest.html.haml", %r(app/cells/blog/latest\.html\.haml)
|
86
|
-
|
87
|
-
|
88
|
-
assert_no_file "app/cells/blog/post.html.erb"
|
89
|
-
assert_no_file "app/cells/blog/post.html.erb"
|
90
|
-
assert_no_file "app/cells/blog/latest.html.erb"
|
91
|
-
|
92
|
-
assert_no_file "app/cells/blog/post.html.slim"
|
93
|
-
assert_no_file "app/cells/blog/post.html.slim"
|
94
|
-
assert_no_file "app/cells/blog/latest.html.slim"
|
95
|
-
end
|
96
|
-
|
97
|
-
should "create test_unit assets with -t test_unit" do
|
98
|
-
run_generator %w(Blog post latest -t test_unit)
|
99
|
-
|
100
|
-
assert_file "test/cells/blog_cell_test.rb"
|
101
|
-
end
|
102
|
-
|
103
|
-
should "work with namespace and test_unit" do
|
104
|
-
run_generator %w(Blog::Post latest -t test_unit)
|
105
|
-
|
106
|
-
assert_file "test/cells/blog/post_cell_test.rb", /class Blog::PostCellTest < Cell::TestCase/
|
107
|
-
end
|
108
|
-
|
109
|
-
should "create test_unit assets with -t rspec" do
|
110
|
-
run_generator %w(Blog post latest -t rspec)
|
9
|
+
test "create the standard assets" do
|
10
|
+
run_generator %w(Blog post latest)
|
111
11
|
|
112
|
-
|
113
|
-
|
12
|
+
assert_file "app/cells/blog_cell.rb", /class BlogCell < Cell::Rails/
|
13
|
+
assert_file "app/cells/blog_cell.rb", /def post/
|
14
|
+
assert_file "app/cells/blog_cell.rb", /def latest/
|
15
|
+
assert_file "app/cells/blog/post.html.erb", %r(app/cells/blog/post\.html\.erb)
|
16
|
+
assert_file "app/cells/blog/post.html.erb", %r(<p>)
|
17
|
+
assert_file "app/cells/blog/latest.html.erb", %r(app/cells/blog/latest\.html\.erb)
|
18
|
+
|
19
|
+
|
20
|
+
assert_no_file "app/cells/blog/post.html.haml"
|
21
|
+
assert_no_file "app/cells/blog/post.html.haml"
|
22
|
+
assert_no_file "app/cells/blog/latest.html.haml"
|
23
|
+
|
24
|
+
assert_no_file "app/cells/blog/post.html.slim"
|
25
|
+
assert_no_file "app/cells/blog/post.html.slim"
|
26
|
+
assert_no_file "app/cells/blog/latest.html.slim"
|
27
|
+
end
|
28
|
+
|
29
|
+
test "create cell that inherits from custom cell class if specified" do
|
30
|
+
run_generator %w(Blog --base-cell-class=ApplicationCell)
|
31
|
+
assert_file "app/cells/blog_cell.rb", /class BlogCell < ApplicationCell/
|
32
|
+
end
|
33
|
+
|
34
|
+
test "work with namespaces" do
|
35
|
+
run_generator %w(Blog::Post latest)
|
36
|
+
|
37
|
+
assert_file "app/cells/blog/post_cell.rb", /class Blog::PostCell < Cell::Rails/
|
38
|
+
assert_file "app/cells/blog/post_cell.rb", /def latest/
|
39
|
+
assert_file "app/cells/blog/post/latest.html.erb", %r(app/cells/blog/post/latest\.html\.erb)
|
40
|
+
end
|
41
|
+
|
42
|
+
test "work with namespaces and haml" do
|
43
|
+
run_generator %w(Blog::Post latest -e haml)
|
44
|
+
|
45
|
+
assert_file "app/cells/blog/post_cell.rb", /class Blog::PostCell < Cell::Rails/
|
46
|
+
assert_file "app/cells/blog/post/latest.html.haml", %r(app/cells/blog/post/latest\.html\.haml)
|
47
|
+
end
|
48
|
+
|
49
|
+
test "work with namespaces and slim" do
|
50
|
+
run_generator %w(Blog::Post latest -e slim)
|
51
|
+
|
52
|
+
assert_file "app/cells/blog/post_cell.rb", /class Blog::PostCell < Cell::Rails/
|
53
|
+
assert_file "app/cells/blog/post/latest.html.slim", %r(app/cells/blog/post/latest\.html\.slim)
|
54
|
+
end
|
55
|
+
|
56
|
+
test "create slim assets with -e slim" do
|
57
|
+
run_generator %w(Blog post latest -e slim)
|
58
|
+
|
59
|
+
assert_file "app/cells/blog_cell.rb", /class BlogCell < Cell::Rails/
|
60
|
+
assert_file "app/cells/blog_cell.rb", /def post/
|
61
|
+
assert_file "app/cells/blog_cell.rb", /def latest/
|
62
|
+
assert_file "app/cells/blog/post.html.slim", %r(app/cells/blog/post\.html\.slim)
|
63
|
+
assert_file "app/cells/blog/post.html.slim", %r(p)
|
64
|
+
assert_file "app/cells/blog/latest.html.slim", %r(app/cells/blog/latest\.html\.slim)
|
65
|
+
|
66
|
+
|
67
|
+
assert_no_file "app/cells/blog/post.html.erb"
|
68
|
+
assert_no_file "app/cells/blog/post.html.erb"
|
69
|
+
assert_no_file "app/cells/blog/latest.html.erb"
|
70
|
+
|
71
|
+
assert_no_file "app/cells/blog/post.html.haml"
|
72
|
+
assert_no_file "app/cells/blog/post.html.haml"
|
73
|
+
assert_no_file "app/cells/blog/latest.html.haml"
|
74
|
+
end
|
75
|
+
|
76
|
+
test "create haml assets with -e haml" do
|
77
|
+
run_generator %w(Blog post latest -e haml)
|
78
|
+
|
79
|
+
assert_file "app/cells/blog_cell.rb", /class BlogCell < Cell::Rails/
|
80
|
+
assert_file "app/cells/blog_cell.rb", /def post/
|
81
|
+
assert_file "app/cells/blog_cell.rb", /def latest/
|
82
|
+
assert_file "app/cells/blog/post.html.haml", %r(app/cells/blog/post\.html\.haml)
|
83
|
+
assert_file "app/cells/blog/post.html.haml", %r(%p)
|
84
|
+
assert_file "app/cells/blog/latest.html.haml", %r(app/cells/blog/latest\.html\.haml)
|
85
|
+
|
86
|
+
|
87
|
+
assert_no_file "app/cells/blog/post.html.erb"
|
88
|
+
assert_no_file "app/cells/blog/post.html.erb"
|
89
|
+
assert_no_file "app/cells/blog/latest.html.erb"
|
90
|
+
|
91
|
+
assert_no_file "app/cells/blog/post.html.slim"
|
92
|
+
assert_no_file "app/cells/blog/post.html.slim"
|
93
|
+
assert_no_file "app/cells/blog/latest.html.slim"
|
94
|
+
end
|
95
|
+
|
96
|
+
test "create test_unit assets with -t test_unit" do
|
97
|
+
run_generator %w(Blog post latest -t test_unit)
|
98
|
+
|
99
|
+
assert_file "test/cells/blog_cell_test.rb"
|
100
|
+
end
|
101
|
+
|
102
|
+
test "work with namespace and test_unit" do
|
103
|
+
run_generator %w(Blog::Post latest -t test_unit)
|
104
|
+
|
105
|
+
assert_file "test/cells/blog/post_cell_test.rb", /class Blog::PostCellTest < Cell::TestCase/
|
106
|
+
end
|
107
|
+
|
108
|
+
test "create test_unit assets with -t rspec" do
|
109
|
+
run_generator %w(Blog post latest -t rspec)
|
110
|
+
|
111
|
+
assert_no_file "test/cells/blog_cell_test.rb"
|
114
112
|
end
|
115
113
|
end
|
data/test/cell_module_test.rb
CHANGED
@@ -42,16 +42,16 @@ class CellBaseTest < MiniTest::Spec
|
|
42
42
|
end
|
43
43
|
|
44
44
|
|
45
|
-
class CellModuleTest <
|
45
|
+
class CellModuleTest < MiniTest::Spec
|
46
46
|
include Cell::TestCase::TestMethods
|
47
|
-
|
47
|
+
describe "Cell::Rails" do
|
48
48
|
# FUNCTIONAL:
|
49
|
-
|
50
|
-
|
49
|
+
describe "render_cell_for" do
|
50
|
+
it "render the actual cell" do
|
51
51
|
assert_equal "Doo", Cell::Rails.render_cell_for(:bassist, :play, @controller)
|
52
52
|
end
|
53
53
|
|
54
|
-
|
54
|
+
it "accept a block, passing the cell instance" do
|
55
55
|
flag = false
|
56
56
|
html = Cell::Rails.render_cell_for(:bassist, :play, @controller) do |cell|
|
57
57
|
assert_equal BassistCell, cell.class
|
@@ -63,8 +63,8 @@ class CellModuleTest < ActiveSupport::TestCase
|
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
66
|
-
|
67
|
-
|
66
|
+
describe "create_cell_for" do
|
67
|
+
it "call the cell's builders, eventually returning a different class" do
|
68
68
|
class DrummerCell < BassistCell
|
69
69
|
build do
|
70
70
|
BassistCell
|
@@ -75,8 +75,8 @@ class CellModuleTest < ActiveSupport::TestCase
|
|
75
75
|
end
|
76
76
|
end
|
77
77
|
|
78
|
-
|
79
|
-
|
78
|
+
describe "#create_cell_for with #build" do
|
79
|
+
before do
|
80
80
|
@controller.class_eval do
|
81
81
|
attr_accessor :bassist
|
82
82
|
end
|
@@ -86,7 +86,7 @@ class CellModuleTest < ActiveSupport::TestCase
|
|
86
86
|
end
|
87
87
|
end
|
88
88
|
|
89
|
-
|
89
|
+
after do
|
90
90
|
MusicianCell.class_eval do
|
91
91
|
@builders = false
|
92
92
|
end
|
@@ -95,24 +95,24 @@ class CellModuleTest < ActiveSupport::TestCase
|
|
95
95
|
end
|
96
96
|
end
|
97
97
|
|
98
|
-
|
98
|
+
it "execute the block in controller describe" do
|
99
99
|
@controller.bassist = true
|
100
100
|
assert_is_a BassistCell, Cell::Rails.create_cell_for(:musician, @controller)
|
101
101
|
end
|
102
102
|
|
103
|
-
|
103
|
+
it "limit the builder to the receiving class" do
|
104
104
|
assert_is_a PianistCell, Cell::Rails.create_cell_for(:pianist, @controller) # don't inherit anything.
|
105
105
|
@controller.bassist = true
|
106
106
|
assert_is_a BassistCell, Cell::Rails.create_cell_for(:musician, @controller)
|
107
107
|
end
|
108
108
|
|
109
|
-
|
109
|
+
it "chain build blocks and execute them by ORing them in the same order" do
|
110
110
|
MusicianCell.build do
|
111
111
|
PianistCell unless bassist
|
112
112
|
end
|
113
113
|
|
114
114
|
MusicianCell.build do
|
115
|
-
UnknownCell #
|
115
|
+
UnknownCell # it never be executed.
|
116
116
|
end
|
117
117
|
|
118
118
|
assert_is_a PianistCell, Cell::Rails.create_cell_for(:musician, @controller) # bassist is false.
|
@@ -120,15 +120,15 @@ class CellModuleTest < ActiveSupport::TestCase
|
|
120
120
|
assert_is_a BassistCell, Cell::Rails.create_cell_for(:musician, @controller)
|
121
121
|
end
|
122
122
|
|
123
|
-
|
123
|
+
it "use the original cell if no builder matches" do
|
124
124
|
assert_is_a MusicianCell, Cell::Rails.create_cell_for(:musician, @controller) # bassist is false.
|
125
125
|
end
|
126
126
|
|
127
|
-
|
127
|
+
it "stop at the first builder returning a valid cell" do
|
128
128
|
|
129
129
|
end
|
130
130
|
|
131
|
-
|
131
|
+
it "pass options to the block" do
|
132
132
|
BassistCell.build do |opts|
|
133
133
|
SingerCell if opts[:sing_the_song]
|
134
134
|
end
|
@@ -136,29 +136,29 @@ class CellModuleTest < ActiveSupport::TestCase
|
|
136
136
|
assert_kind_of SingerCell, Cell::Rails.create_cell_for(:bassist, @controller, {:sing_the_song => true})
|
137
137
|
end
|
138
138
|
|
139
|
-
|
139
|
+
it "create the original target class if no block matches" do
|
140
140
|
assert_kind_of PianistCell, Cell::Rails.create_cell_for(:pianist, @controller)
|
141
141
|
end
|
142
142
|
|
143
|
-
|
143
|
+
it "builders it return an empty array per default" do
|
144
144
|
assert_equal [], PianistCell.send(:builders)
|
145
145
|
end
|
146
146
|
end
|
147
147
|
|
148
|
-
|
148
|
+
it "provide class_from_cell_name" do
|
149
149
|
assert_equal BassistCell, ::Cell::Rails.class_from_cell_name('bassist')
|
150
150
|
end
|
151
151
|
|
152
152
|
if Cell.rails3_0?
|
153
|
-
|
153
|
+
it "provide possible_paths_for_state" do
|
154
154
|
assert_equal ["bad_guitarist/play", "bassist/play"], cell(:bad_guitarist).send(:possible_paths_for_state, :play)
|
155
155
|
end
|
156
156
|
|
157
|
-
|
157
|
+
it "provide Cell.cell_name" do
|
158
158
|
assert_equal 'bassist', cell(:bassist).class.cell_name
|
159
159
|
end
|
160
160
|
|
161
|
-
|
161
|
+
it "provide cell_name for modules, too" do
|
162
162
|
class SingerCell < Cell::Rails
|
163
163
|
end
|
164
164
|
|
@@ -167,16 +167,20 @@ class CellModuleTest < ActiveSupport::TestCase
|
|
167
167
|
end
|
168
168
|
end
|
169
169
|
|
170
|
-
|
171
|
-
if Rails::VERSION::
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
170
|
+
it "respond to #rails3_1_or_more?" do
|
171
|
+
if Rails::VERSION::MAJOR == 3
|
172
|
+
if Rails::VERSION::MINOR == 0
|
173
|
+
assert ! Cell.rails3_1_or_more?
|
174
|
+
assert Cell.rails3_0?
|
175
|
+
elsif Rails::VERSION::MINOR == 1
|
176
|
+
assert Cell.rails3_1_or_more?
|
177
|
+
assert ! Cell.rails3_0?
|
178
|
+
elsif Rails::VERSION::MINOR == 2
|
179
|
+
assert Cell.rails3_1_or_more?
|
180
|
+
assert ! Cell.rails3_0?
|
181
|
+
end
|
182
|
+
elsif Rails::VERSION::MAJOR == 4
|
183
|
+
assert Cell.rails4_0_or_more?
|
180
184
|
end
|
181
185
|
end
|
182
186
|
end
|