cells 4.1.7 → 4.1.8

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 (60) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGES.md +5 -0
  3. data/README.md +18 -19
  4. data/cells.gemspec +30 -22
  5. data/lib/cell/version.rb +1 -1
  6. data/lib/cell/view_model.rb +1 -2
  7. metadata +58 -78
  8. data/.gitignore +0 -9
  9. data/.travis.yml +0 -16
  10. data/Gemfile +0 -10
  11. data/Rakefile +0 -28
  12. data/TODO.md +0 -12
  13. data/benchmarks/class_builder.rb +0 -37
  14. data/benchmarks/collection.rb +0 -47
  15. data/test/builder_test.rb +0 -63
  16. data/test/cache_test.rb +0 -32
  17. data/test/cell_benchmark.rb +0 -32
  18. data/test/cell_test.rb +0 -20
  19. data/test/concept_test.rb +0 -87
  20. data/test/context_test.rb +0 -44
  21. data/test/fixtures/bassist/play.erb +0 -1
  22. data/test/fixtures/cell_test/song/show_with_block.erb +0 -1
  23. data/test/fixtures/comment/layout/show.erb +0 -1
  24. data/test/fixtures/comment/show/show.erb +0 -1
  25. data/test/fixtures/concepts/record/views/layout.erb +0 -1
  26. data/test/fixtures/concepts/record/views/show.erb +0 -1
  27. data/test/fixtures/concepts/record/views/song.erb +0 -1
  28. data/test/fixtures/inherit_views_test/popper/tap.erb +0 -1
  29. data/test/fixtures/inherit_views_test/tapper/play.erb +0 -1
  30. data/test/fixtures/inherit_views_test/tapper/tap.erb +0 -1
  31. data/test/fixtures/partial_test/with_partial/show.erb +0 -1
  32. data/test/fixtures/partials/_show.html.erb +0 -1
  33. data/test/fixtures/partials/_show.xml.erb +0 -1
  34. data/test/fixtures/song/ivar.erb +0 -1
  35. data/test/fixtures/song/show.erb +0 -1
  36. data/test/fixtures/song/with_block.erb +0 -1
  37. data/test/fixtures/song/with_erb.erb +0 -4
  38. data/test/fixtures/song/with_html.erb +0 -1
  39. data/test/fixtures/song/with_locals.erb +0 -2
  40. data/test/fixtures/song_with_layout/happy.erb +0 -1
  41. data/test/fixtures/song_with_layout/merry.erb +0 -1
  42. data/test/fixtures/song_with_layout/show.erb +0 -1
  43. data/test/fixtures/song_with_layout/show_with_layout.erb +0 -1
  44. data/test/fixtures/templates_caching_test/song/show.erb +0 -1
  45. data/test/fixtures/url_helper_test/song/edit.erb +0 -8
  46. data/test/fixtures/url_helper_test/song/with_block.erb +0 -2
  47. data/test/fixtures/url_helper_test/song/with_capture.erb +0 -4
  48. data/test/fixtures/url_helper_test/song/with_content_tag.erb +0 -6
  49. data/test/fixtures/url_helper_test/song/with_form_for_block.erb +0 -3
  50. data/test/fixtures/url_helper_test/song/with_link_to.erb +0 -3
  51. data/test/layout_test.rb +0 -88
  52. data/test/partial_test.rb +0 -35
  53. data/test/prefixes_test.rb +0 -133
  54. data/test/property_test.rb +0 -48
  55. data/test/public_test.rb +0 -99
  56. data/test/render_test.rb +0 -115
  57. data/test/templates_test.rb +0 -44
  58. data/test/test_helper.rb +0 -13
  59. data/test/testing_test.rb +0 -59
  60. data/test/twin_test.rb +0 -26
data/test/builder_test.rb DELETED
@@ -1,63 +0,0 @@
1
- require 'test_helper'
2
-
3
- class BuilderTest < MiniTest::Spec
4
- Song = Struct.new(:title)
5
- Hit = Struct.new(:title)
6
-
7
- class SongCell < Cell::ViewModel
8
- include Cell::Builder
9
-
10
- builds do |model, options|
11
- if model.is_a? Hit
12
- HitCell
13
- elsif options[:evergreen]
14
- EvergreenCell
15
- end
16
- end
17
-
18
- def options
19
- @options
20
- end
21
-
22
- def show
23
- "* #{title}"
24
- end
25
-
26
- property :title
27
- end
28
-
29
- class HitCell < SongCell
30
- def show
31
- "* **#{title}**"
32
- end
33
- end
34
-
35
- class EvergreenCell < SongCell
36
- end
37
-
38
- # the original class is used when no builder matches.
39
- it { SongCell.(Song.new("Nation States"), {}).must_be_instance_of SongCell }
40
-
41
- it do
42
- cell = SongCell.(Hit.new("New York"), {})
43
- cell.must_be_instance_of HitCell
44
- cell.options.must_equal({})
45
- end
46
-
47
- it do
48
- cell = SongCell.(Song.new("San Francisco"), evergreen: true)
49
- cell.must_be_instance_of EvergreenCell
50
- cell.options.must_equal({evergreen:true})
51
- end
52
-
53
- # without arguments.
54
- it { SongCell.(Hit.new("Frenzy")).must_be_instance_of HitCell }
55
-
56
- # with collection.
57
- it { SongCell.(collection: [Song.new("Nation States"), Hit.new("New York")]).().must_equal "* Nation States* **New York**" }
58
-
59
- # with Concept
60
- class Track < Cell::Concept
61
- end
62
- it { Track.().must_be_instance_of Track }
63
- end
data/test/cache_test.rb DELETED
@@ -1,32 +0,0 @@
1
- require "test_helper"
2
-
3
- # TODO: test caching without rails
4
-
5
- class CacheTest < Minitest::Spec
6
- STORE = Class.new(Hash) do
7
- def fetch(key, options, &block)
8
- self[key] || self[key] = yield
9
- end
10
- end.new
11
-
12
- module Cache
13
- def show
14
- "#{@model}"
15
- end
16
-
17
- def cache_store
18
- STORE
19
- end
20
- end
21
-
22
- class Index < Cell::ViewModel
23
- cache :show
24
- include Cache
25
- end
26
-
27
- it do
28
- Index.new(1).().must_equal("1")
29
- Index.new(2).().must_equal("1")
30
- end
31
- end
32
-
@@ -1,32 +0,0 @@
1
- require 'test_helper'
2
- require 'benchmark'
3
-
4
- Song = Struct.new(:title)
5
-
6
-
7
- class SongCell < Cell::ViewModel
8
- self.view_paths = ['test']
9
- property :title
10
-
11
- def show
12
- render
13
- end
14
- end
15
-
16
- time = Benchmark.measure do
17
- Cell::ViewModel.cell(:song, nil, collection: 1000.times.collect { Song.new("Anarchy Camp") })
18
- end
19
-
20
- puts time
21
-
22
- # 4.0
23
- # 0.310000 0.010000 0.320000 ( 0.320382)
24
-
25
- # no caching of templates, puts
26
- # 0.570000 0.030000 0.600000 ( 0.600160)
27
-
28
- # caching of templates
29
- # 0.090000 0.000000 0.090000 ( 0.085652)
30
-
31
- # wed, 17.
32
- # 0.120000 0.010000 0.130000 ( 0.127731)
data/test/cell_test.rb DELETED
@@ -1,20 +0,0 @@
1
- require 'test_helper'
2
-
3
- class CellTest < MiniTest::Spec
4
- class SongCell < Cell::ViewModel
5
- self.view_paths = ['test/fixtures']
6
-
7
- def show
8
- end
9
-
10
- def show_with_block(&block)
11
- render(&block)
12
- end
13
- end
14
-
15
- # #options
16
- it { SongCell.new(nil, genre: "Punkrock").send(:options)[:genre].must_equal "Punkrock" }
17
-
18
- # #block
19
- it { SongCell.new(nil, genre: "Punkrock").(:show_with_block) { "hello" }.must_equal "<b>hello</b>\n" }
20
- end
data/test/concept_test.rb DELETED
@@ -1,87 +0,0 @@
1
- require 'test_helper'
2
-
3
- Cell::Concept.class_eval do
4
- self.view_paths = ['test/fixtures/concepts']
5
- end
6
-
7
- # Trailblazer style:
8
- module Record
9
- class Cell < ::Cell::Concept # cell("record")
10
- include ::Cell::Erb
11
-
12
- def show
13
- render # Party On, #{model}
14
- end
15
-
16
- # cell(:song, concept: :record)
17
- class Song < self # cell("record/cell/song")
18
- def show
19
- render view: :song#, layout: "layout"
20
- # TODO: test layout: .. in ViewModel
21
- end
22
- end
23
-
24
- class Hit < ::Cell::Concept
25
- inherit_views Record::Cell
26
- end
27
-
28
-
29
- def description
30
- "A Tribute To Rancid, with #{@options[:tracks]} songs! [#{context}]"
31
- end
32
- end
33
- end
34
-
35
- module Record
36
- module Cells
37
- class Cell < ::Cell::Concept
38
- class Song < ::Cell::Concept
39
- end
40
- end
41
- end
42
- end
43
-
44
- # app/cells/comment/views
45
- # app/cells/comment/form/views
46
- # app/cells/comment/views/form inherit_views Comment::Cell, render form/show
47
-
48
-
49
- class ConceptTest < MiniTest::Spec
50
- describe "::controller_path" do
51
- it { Record::Cell.new.class.controller_path.must_equal "record" }
52
- it { Record::Cell::Song.new.class.controller_path.must_equal "record/song" }
53
- it { Record::Cells::Cell.new.class.controller_path.must_equal "record/cells" }
54
- it { Record::Cells::Cell::Song.new.class.controller_path.must_equal "record/cells/song" }
55
- end
56
-
57
-
58
- describe "#_prefixes" do
59
- it { Record::Cell.new._prefixes.must_equal ["test/fixtures/concepts/record/views"] }
60
- it { Record::Cell::Song.new._prefixes.must_equal ["test/fixtures/concepts/record/song/views", "test/fixtures/concepts/record/views"] }
61
- it { Record::Cell::Hit.new._prefixes.must_equal ["test/fixtures/concepts/record/hit/views", "test/fixtures/concepts/record/views"] } # with inherit_views.
62
- end
63
-
64
- it { Record::Cell.new("Wayne").call(:show).must_equal "Party on, Wayne!" }
65
-
66
-
67
- describe "::cell" do
68
- it { Cell::Concept.cell("record/cell").must_be_instance_of( Record::Cell) }
69
- it { Cell::Concept.cell("record/cell/song").must_be_instance_of Record::Cell::Song }
70
- # cell("song", concept: "record/compilation") # record/compilation/cell/song
71
- end
72
-
73
- describe "#render" do
74
- it { Cell::Concept.cell("record/cell/song").show.must_equal "Lalala" }
75
- end
76
-
77
- describe "#cell (in state)" do
78
- # test with controller, but remove tests when we don't need it anymore.
79
- it { Cell::Concept.cell("record/cell", nil, context: { controller: Object }).cell("record/cell", nil).must_be_instance_of Record::Cell }
80
- it { Cell::Concept.cell("record/cell", nil, context: { controller: Object }).concept("record/cell", nil, tracks: 24).(:description).must_equal "A Tribute To Rancid, with 24 songs! [{:controller=>Object}]" }
81
- # concept(.., collection: ..)
82
- it do
83
- Cell::Concept.cell("record/cell", nil, context: { controller: Object }).
84
- concept("record/cell", collection: [1,2], tracks: 24).(:description).must_equal "A Tribute To Rancid, with 24 songs! [{:controller=>Object}]A Tribute To Rancid, with 24 songs! [{:controller=>Object}]"
85
- end
86
- end
87
- end
data/test/context_test.rb DELETED
@@ -1,44 +0,0 @@
1
- require "test_helper"
2
-
3
- class ContextTest < MiniTest::Spec
4
- class ParentCell < Cell::ViewModel
5
- def user
6
- context[:user]
7
- end
8
-
9
- def controller
10
- context[:controller]
11
- end
12
- end
13
-
14
- let (:model) { Object.new }
15
- let (:user) { Object.new }
16
- let (:controller) { Object.new }
17
-
18
- let (:parent) { ParentCell.(model, admin: true, context: { user: user, controller: controller }) }
19
-
20
- it do
21
- parent.model.must_equal model
22
- parent.controller.must_equal controller
23
- parent.user.must_equal user
24
-
25
- # nested cell
26
- child = parent.cell("context_test/parent", "")
27
-
28
- child.model.must_equal ""
29
- child.controller.must_equal controller
30
- child.user.must_equal user
31
- end
32
-
33
- # child can add to context
34
- it do
35
- child = parent.cell(ParentCell, nil, context: { "is_child?" => true })
36
-
37
- assert_nil(parent.context["is_child?"])
38
-
39
- assert_nil(child.model)
40
- child.controller.must_equal controller
41
- child.user.must_equal user
42
- child.context["is_child?"].must_equal true
43
- end
44
- end
@@ -1 +0,0 @@
1
- Doo
@@ -1 +0,0 @@
1
- <b><%= yield %></b>
@@ -1 +0,0 @@
1
- $layout.erb{<%= yield %>, <%= context.inspect %>}
@@ -1 +0,0 @@
1
- $show.erb, <%= context.inspect %>
@@ -1 +0,0 @@
1
- <p><%= yield %></p>
@@ -1 +0,0 @@
1
- Party on, <%= model %>!
@@ -1 +0,0 @@
1
- Lalala
@@ -1 +0,0 @@
1
- TTttttap I'm not good enough!
@@ -1 +0,0 @@
1
- Dooom!
@@ -1 +0,0 @@
1
- Tap tap tap!
@@ -1 +0,0 @@
1
- Adenosine Breakdown
@@ -1 +0,0 @@
1
- I Am Wrong And I Am Right
@@ -1 +0,0 @@
1
- <xml>I Am Wrong And I Am Right</xml>
@@ -1 +0,0 @@
1
- <%= @title %>
@@ -1 +0,0 @@
1
- <%= title %>
@@ -1 +0,0 @@
1
- Yo! <%= yield %>
@@ -1,4 +0,0 @@
1
- ERB:
2
- <%= content_tag(:span) do %>
3
- <%= title %>
4
- <% end %>
@@ -1 +0,0 @@
1
- <p>Yew!</p>
@@ -1,2 +0,0 @@
1
- <%= title %>
2
- <%= length %>
@@ -1 +0,0 @@
1
- <%= "Happy #{yield}!" %>
@@ -1 +0,0 @@
1
- <%= "Merry #{what}, #{yield}" %>
@@ -1 +0,0 @@
1
- <%= title %>
@@ -1 +0,0 @@
1
- The Great Mind Eraser
@@ -1,8 +0,0 @@
1
- <%= form_tag "/songs" do %>
2
- <%= label_tag :title %>
3
- <%= text_field_tag :title %>
4
-
5
- <%= content_tag :ul do %>
6
- <%= content_tag :li, "Airplays: 1" %>
7
- <%= end %>
8
- <%= end %>
@@ -1,2 +0,0 @@
1
- Nice!
2
- <%= cap { "<b>yeah</b>" } %>
@@ -1,4 +0,0 @@
1
- Nice!
2
- <%= capture do %>
3
- <%= "<b>Great!</b>" %>
4
- <% end %>
@@ -1,6 +0,0 @@
1
- <%= content_tag :span do %>
2
- "Title:"
3
- <%= content_tag :div do %>
4
- <%= "Still Knee Deep" %>
5
- <% end %>
6
- <%- end -%>
@@ -1,3 +0,0 @@
1
- <%= form_for(OpenStruct.new, url: "/songs", as: :song) do |f| %>
2
- <%= f.text_field :id %>
3
- <% end %>
@@ -1,3 +0,0 @@
1
- <%= link_to songs_path do %>
2
- <%= image_tag "all.png" %>
3
- <% end %>
data/test/layout_test.rb DELETED
@@ -1,88 +0,0 @@
1
- require 'test_helper'
2
-
3
- class SongWithLayoutCell < Cell::ViewModel
4
- self.view_paths = ['test/fixtures']
5
- # include Cell::Erb
6
-
7
- def show
8
- render layout: :merry
9
- end
10
-
11
- def unknown
12
- render layout: :no_idea_what_u_mean
13
- end
14
-
15
- def what
16
- "Xmas"
17
- end
18
-
19
- def string
20
- "Right"
21
- end
22
-
23
- private
24
- def title
25
- "<b>Papertiger</b>"
26
- end
27
- end
28
-
29
- class SongWithLayoutOnClassCell < SongWithLayoutCell
30
- # inherit_views SongWithLayoutCell
31
- layout :merry
32
-
33
- def show
34
- render
35
- end
36
-
37
- def show_with_layout
38
- render layout: :happy
39
- end
40
- end
41
-
42
- class LayoutTest < MiniTest::Spec
43
- # render show.haml calling method.
44
- # same context as content view as layout call method.
45
- it { SongWithLayoutCell.new(nil).show.must_equal "Merry Xmas, <b>Papertiger</b>" }
46
-
47
- # raises exception when layout not found!
48
-
49
- it { assert_raises(Cell::TemplateMissingError) { SongWithLayoutCell.new(nil).unknown } }
50
- # assert message of exception.
51
- it { }
52
-
53
- # with ::layout.
54
- it { SongWithLayoutOnClassCell.new(nil).show.must_equal "Merry Xmas, <b>Papertiger</b>" }
55
-
56
- # with ::layout and :layout, :layout wins.
57
- it { SongWithLayoutOnClassCell.new(nil).show_with_layout.must_equal "Happy Friday!" }
58
- end
59
-
60
- module Comment
61
- class ShowCell < Cell::ViewModel
62
- self.view_paths = ['test/fixtures']
63
- include Layout::External
64
-
65
- def show
66
- render + render
67
- end
68
- end
69
-
70
- class LayoutCell < Cell::ViewModel
71
- self.view_paths = ['test/fixtures']
72
- end
73
- end
74
-
75
- class ExternalLayoutTest < Minitest::Spec
76
- it do
77
- Comment::ShowCell.new(nil, layout: Comment::LayoutCell, context: { beer: true }).
78
- ().must_equal "$layout.erb{$show.erb, {:beer=>true}$show.erb, {:beer=>true}, {:beer=>true}}
79
- "
80
- end
81
-
82
- # collection :layout
83
- it do
84
- Cell::ViewModel.cell("comment/show", collection: [Object, Module], layout: Comment::LayoutCell).().
85
- must_equal "$layout.erb{$show.erb, nil$show.erb, nil$show.erb, nil$show.erb, nil, nil}
86
- "
87
- end
88
- end
data/test/partial_test.rb DELETED
@@ -1,35 +0,0 @@
1
- require "test_helper"
2
- require "cell/partial"
3
-
4
- class PartialTest < MiniTest::Spec
5
- class WithPartial < Cell::ViewModel
6
- self.view_paths = ['test/fixtures'] # doesn't exist.
7
- include ::Cell::Erb
8
-
9
- include Partial
10
-
11
- def show
12
- render partial: "../fixtures/partials/show.html"
13
- end
14
-
15
- def show_with_format
16
- render partial: "../fixtures/partials/show", formats: [:xml]
17
- end
18
-
19
- def show_without_partial
20
- render :show
21
- end
22
- end
23
-
24
- class WithPartialAndManyViewPaths < WithPartial
25
- self.view_paths << ['app/views']
26
- end
27
-
28
- it { WithPartial.new(nil).show.must_equal "I Am Wrong And I Am Right" }
29
- it { WithPartial.new(nil).show_with_format.must_equal "<xml>I Am Wrong And I Am Right</xml>" }
30
- it { WithPartial.new(nil).show_without_partial.must_equal "Adenosine Breakdown" }
31
-
32
- it { WithPartialAndManyViewPaths.new(nil).show.must_equal "I Am Wrong And I Am Right" }
33
- it { WithPartialAndManyViewPaths.new(nil).show_with_format.must_equal "<xml>I Am Wrong And I Am Right</xml>" }
34
- it { WithPartialAndManyViewPaths.new(nil).show_without_partial.must_equal "Adenosine Breakdown" }
35
- end
@@ -1,133 +0,0 @@
1
- require 'test_helper'
2
-
3
- class BassistCell::FenderCell < Cell::ViewModel
4
- end
5
-
6
- class BassistCell::IbanezCell < BassistCell
7
- end
8
-
9
- class WannabeCell < BassistCell::IbanezCell
10
- end
11
-
12
- # engine: shopify
13
- # shopify/cart/cell
14
-
15
- class EngineCell < Cell::ViewModel
16
- self.view_paths << "/var/engine/app/cells"
17
- end
18
- class InheritingFromEngineCell < EngineCell
19
- end
20
-
21
- class PrefixesTest < MiniTest::Spec
22
- class SingerCell < Cell::ViewModel
23
- end
24
-
25
- class BackgroundVocalsCell < SingerCell
26
- end
27
-
28
- class ChorusCell < BackgroundVocalsCell
29
- end
30
-
31
- class GuitaristCell < SingerCell
32
- def self._local_prefixes
33
- ["stringer"]
34
- end
35
- end
36
-
37
- class BassistCell < SingerCell
38
- def self._local_prefixes
39
- super + ["basser"]
40
- end
41
- end
42
-
43
-
44
- describe "::controller_path" do
45
- it { ::BassistCell.new(@controller).class.controller_path.must_equal "bassist" }
46
- it { SingerCell.new(@controller).class.controller_path.must_equal "prefixes_test/singer" }
47
- end
48
-
49
- describe "#_prefixes" do
50
- it { ::BassistCell.new(@controller)._prefixes.must_equal ["test/fixtures/bassist"] }
51
- it { ::BassistCell::FenderCell.new(@controller)._prefixes.must_equal ["app/cells/bassist_cell/fender"] }
52
- it { ::BassistCell::IbanezCell.new(@controller)._prefixes.must_equal ["test/fixtures/bassist_cell/ibanez", "test/fixtures/bassist"] }
53
-
54
- it { SingerCell.new(@controller)._prefixes.must_equal ["app/cells/prefixes_test/singer"] }
55
- it { BackgroundVocalsCell.new(@controller)._prefixes.must_equal ["app/cells/prefixes_test/background_vocals", "app/cells/prefixes_test/singer"] }
56
- it { ChorusCell.new(@controller)._prefixes.must_equal ["app/cells/prefixes_test/chorus", "app/cells/prefixes_test/background_vocals", "app/cells/prefixes_test/singer"] }
57
-
58
- it { GuitaristCell.new(@controller)._prefixes.must_equal ["stringer", "app/cells/prefixes_test/singer"] }
59
- it { BassistCell.new(@controller)._prefixes.must_equal ["app/cells/prefixes_test/bassist", "basser", "app/cells/prefixes_test/singer"] }
60
- # it { DrummerCell.new(@controller)._prefixes.must_equal ["drummer", "stringer", "prefixes_test/singer"] }
61
-
62
- # multiple view_paths.
63
- it { EngineCell.prefixes.must_equal ["app/cells/engine", "/var/engine/app/cells/engine"] }
64
- it do
65
- InheritingFromEngineCell.prefixes.must_equal [
66
- "app/cells/inheriting_from_engine", "/var/engine/app/cells/inheriting_from_engine",
67
- "app/cells/engine", "/var/engine/app/cells/engine"]
68
- end
69
-
70
- # ::_prefixes is cached.
71
- it do
72
- WannabeCell.prefixes.must_equal ["test/fixtures/wannabe", "test/fixtures/bassist_cell/ibanez", "test/fixtures/bassist"]
73
- WannabeCell.instance_eval { def _local_prefixes; ["more"] end }
74
- # _prefixes is cached.
75
- WannabeCell.prefixes.must_equal ["test/fixtures/wannabe", "test/fixtures/bassist_cell/ibanez", "test/fixtures/bassist"]
76
- # superclasses don't get disturbed.
77
- ::BassistCell.prefixes.must_equal ["test/fixtures/bassist"]
78
- end
79
- end
80
-
81
- # it { Record::Cell.new(@controller).render_state(:show).must_equal "Rock on!" }
82
- end
83
-
84
- class InheritViewsTest < MiniTest::Spec
85
- class SlapperCell < Cell::ViewModel
86
- self.view_paths = ['test/fixtures'] # todo: REMOVE!
87
- include Cell::Erb
88
-
89
- inherit_views ::BassistCell
90
-
91
- def play
92
- render
93
- end
94
- end
95
-
96
- class FunkerCell < SlapperCell
97
- end
98
-
99
- it { SlapperCell.new(nil)._prefixes.must_equal ["test/fixtures/inherit_views_test/slapper", "test/fixtures/bassist"] }
100
- it { FunkerCell.new(nil)._prefixes.must_equal ["test/fixtures/inherit_views_test/funker", "test/fixtures/inherit_views_test/slapper", "test/fixtures/bassist"] }
101
-
102
- # test if normal cells inherit views.
103
- it { cell('inherit_views_test/slapper').play.must_equal 'Doo' }
104
- it { cell('inherit_views_test/funker').play.must_equal 'Doo' }
105
-
106
-
107
- # TapperCell
108
- class TapperCell < Cell::ViewModel
109
- self.view_paths = ['test/fixtures']
110
- # include Cell::Erb
111
-
112
- def play
113
- render
114
- end
115
-
116
- def tap
117
- render
118
- end
119
- end
120
-
121
- class PopperCell < TapperCell
122
- end
123
-
124
- # Tapper renders its play
125
- it { cell('inherit_views_test/tapper').call(:play).must_equal 'Dooom!' }
126
- # Tapper renders its tap
127
- it { cell('inherit_views_test/tapper').call(:tap).must_equal 'Tap tap tap!' }
128
-
129
- # Popper renders Tapper's play
130
- it { cell('inherit_views_test/popper').call(:play).must_equal 'Dooom!' }
131
- # Popper renders its tap
132
- it { cell('inherit_views_test/popper').call(:tap).must_equal "TTttttap I'm not good enough!" }
133
- end