cells 3.11.3 → 4.0.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.
- checksums.yaml +4 -4
- data/.gitignore +1 -1
- data/.travis.yml +15 -13
- data/Appraisals +23 -0
- data/CHANGES.md +20 -3
- data/Gemfile +5 -7
- data/README.md +317 -236
- data/Rakefile +1 -1
- data/TODO.md +3 -0
- data/cells.gemspec +19 -28
- data/gemfiles/rails3.2.gemfile +14 -0
- data/gemfiles/rails4.0.gemfile +14 -0
- data/gemfiles/rails4.1.gemfile +15 -0
- data/gemfiles/rails4.2.gemfile +14 -0
- data/lib/cell.rb +28 -21
- data/lib/cell/caching.rb +10 -22
- data/lib/cell/caching/notification.rb +15 -0
- data/lib/cell/concept.rb +4 -69
- data/lib/cell/development.rb +11 -0
- data/lib/{cells → cell}/engines.rb +1 -1
- data/lib/cell/layout.rb +20 -0
- data/lib/cell/partial.rb +17 -0
- data/lib/cell/{base/prefixes.rb → prefixes.rb} +1 -1
- data/lib/cell/rails.rb +58 -50
- data/lib/cell/railtie.rb +60 -0
- data/lib/cell/{base/self_contained.rb → self_contained.rb} +1 -1
- data/lib/cell/templates.rb +60 -0
- data/lib/cell/test_case.rb +4 -162
- data/lib/cell/testing.rb +15 -0
- data/lib/cell/twin.rb +11 -29
- data/lib/cell/version.rb +10 -0
- data/lib/cell/view_model.rb +196 -88
- data/lib/cells.rb +1 -20
- data/lib/rails/generators/cell/cell_generator.rb +43 -0
- data/lib/rails/generators/cell/templates/cell.rb.erb +8 -0
- data/lib/{generators/templates/concept → rails/generators/cell/templates}/view.erb +0 -0
- data/lib/{generators/templates/concept → rails/generators/cell/templates}/view.haml +0 -0
- data/lib/rails/generators/cell/templates/view.slim +2 -0
- data/lib/rails/generators/concept/concept_generator.rb +38 -0
- data/lib/{generators/templates/concept/cell.rb → rails/generators/concept/templates/concept.rb.erb} +2 -2
- data/lib/{generators → rails/generators/concept}/templates/view.erb +0 -0
- data/lib/{generators → rails/generators/concept}/templates/view.haml +0 -0
- data/lib/rails/generators/concept/templates/view.slim +2 -0
- data/lib/rails/generators/test_unit/cell/cell_generator.rb +21 -0
- data/lib/{generators/templates/cell_test.rb → rails/generators/test_unit/cell/templates/unit_test.rb.erb} +3 -3
- data/lib/rails/generators/test_unit/concept/concept_generator.rb +21 -0
- data/lib/rails/generators/test_unit/concept/templates/unit_test.rb.erb +11 -0
- data/lib/{cells → tasks}/cells.rake +0 -0
- data/test/builder_test.rb +58 -0
- data/test/caching_test.rb +298 -0
- data/test/cell_benchmark.rb +32 -0
- data/test/cell_generator_test.rb +51 -82
- data/test/cell_test.rb +8 -23
- data/test/concept_generator_test.rb +22 -13
- data/test/concept_test.rb +41 -75
- data/test/dummy/app/views/musician/hamlet.html.erb +1 -0
- data/test/dummy/config/application.rb +21 -8
- data/test/{app/cells/bassist/play.html.erb → fixtures/bassist/play.erb} +0 -0
- data/test/fixtures/concepts/record/views/layout.erb +1 -0
- data/test/{app → fixtures}/concepts/record/views/show.erb +0 -0
- data/test/{app → fixtures}/concepts/record/views/song.erb +0 -0
- data/test/fixtures/inherit_views_test/popper/tap.erb +1 -0
- data/test/fixtures/inherit_views_test/tapper/play.erb +1 -0
- data/test/fixtures/inherit_views_test/tapper/tap.erb +1 -0
- data/test/fixtures/partial_test/with_partial/show.erb +1 -0
- data/test/fixtures/partials/_show.html.erb +1 -0
- data/test/fixtures/partials/_show.xml.erb +1 -0
- data/test/fixtures/song/ivar.erb +1 -0
- data/test/fixtures/song/show.erb +1 -0
- data/test/fixtures/song/with_erb.erb +4 -0
- data/test/fixtures/song/with_html.erb +1 -0
- data/test/fixtures/song/with_locals.erb +2 -0
- data/test/fixtures/song_with_layout/happy.erb +1 -0
- data/test/fixtures/song_with_layout/merry.erb +1 -0
- data/test/fixtures/song_with_layout/show.erb +1 -0
- data/test/fixtures/song_with_layout/show_with_layout.erb +1 -0
- data/test/fixtures/templates_caching_test/song/show.erb +1 -0
- data/test/fixtures/url_helper_test/song/edit.erb +8 -0
- data/test/fixtures/url_helper_test/song/with_block.erb +2 -0
- data/test/fixtures/url_helper_test/song/with_capture.erb +4 -0
- data/test/fixtures/url_helper_test/song/with_content_tag.erb +6 -0
- data/test/fixtures/url_helper_test/song/with_form_for_block.erb +3 -0
- data/test/fixtures/url_helper_test/song/with_link_to.erb +3 -0
- data/test/layout_test.rb +57 -0
- data/test/partial_test.rb +27 -0
- data/test/prefixes_test.rb +36 -10
- data/test/public_test.rb +42 -0
- data/test/rails_extensions_test.rb +51 -0
- data/test/render_test.rb +103 -0
- data/test/templates_test.rb +45 -0
- data/test/test_case_test.rb +21 -122
- data/test/test_helper.rb +37 -33
- data/test/twin_test.rb +3 -7
- data/test/url_helper_test.rb +89 -0
- metadata +92 -357
- data/gemfiles/Gemfile.rails3-0 +0 -7
- data/gemfiles/Gemfile.rails3-1 +0 -7
- data/gemfiles/Gemfile.rails3-2 +0 -7
- data/gemfiles/Gemfile.rails4-0 +0 -12
- data/gemfiles/Gemfile.rails4-1 +0 -12
- data/lib/cell/base.rb +0 -82
- data/lib/cell/base/view.rb +0 -15
- data/lib/cell/builder.rb +0 -71
- data/lib/cell/deprecations.rb +0 -41
- data/lib/cell/dsl.rb +0 -7
- data/lib/cell/rack.rb +0 -32
- data/lib/cell/rails/helper_api.rb +0 -37
- data/lib/cell/rails/view_model.rb +0 -159
- data/lib/cell/rails3_0_strategy.rb +0 -82
- data/lib/cell/rails3_1_strategy.rb +0 -40
- data/lib/cell/rails4_0_strategy.rb +0 -39
- data/lib/cell/rails4_1_strategy.rb +0 -40
- data/lib/cell/rendering.rb +0 -109
- data/lib/cells/rails.rb +0 -86
- data/lib/cells/railtie.rb +0 -38
- data/lib/cells/version.rb +0 -3
- data/lib/generators/USAGE +0 -30
- data/lib/generators/cells/base.rb +0 -22
- data/lib/generators/cells/cell_generator.rb +0 -15
- data/lib/generators/cells/view_generator.rb +0 -18
- data/lib/generators/erb/cell_generator.rb +0 -15
- data/lib/generators/erb/concept_generator.rb +0 -17
- data/lib/generators/haml/cell_generator.rb +0 -17
- data/lib/generators/haml/concept_generator.rb +0 -17
- data/lib/generators/rails/cell_generator.rb +0 -16
- data/lib/generators/rails/concept_generator.rb +0 -16
- data/lib/generators/slim/cell_generator.rb +0 -17
- data/lib/generators/templates/cell.rb +0 -9
- data/lib/generators/templates/view.slim +0 -4
- data/lib/generators/test_unit/cell_generator.rb +0 -14
- data/lib/generators/trailblazer/base.rb +0 -21
- data/lib/generators/trailblazer/view_generator.rb +0 -18
- data/test/app/cells/album/views/cover.haml +0 -1
- data/test/app/cells/bad_guitarist/_dii.html.erb +0 -1
- data/test/app/cells/bad_guitarist_cell.rb +0 -2
- data/test/app/cells/bassist/_dii.html.erb +0 -1
- data/test/app/cells/bassist/ahem.html.erb +0 -1
- data/test/app/cells/bassist/compose.html.erb +0 -1
- data/test/app/cells/bassist/contact_form.html.erb +0 -1
- data/test/app/cells/bassist/form_for.erb +0 -3
- data/test/app/cells/bassist/form_for_in_haml.haml +0 -2
- data/test/app/cells/bassist/jam.html.erb +0 -3
- data/test/app/cells/bassist/play.js.erb +0 -1
- data/test/app/cells/bassist/pose.html.erb +0 -1
- data/test/app/cells/bassist/promote.html.erb +0 -1
- data/test/app/cells/bassist/provoke.html.erb +0 -1
- data/test/app/cells/bassist/shout.html.erb +0 -1
- data/test/app/cells/bassist/sing.html.haml +0 -1
- data/test/app/cells/bassist/slap.html.erb +0 -1
- data/test/app/cells/bassist/yell.en.html.erb +0 -1
- data/test/app/cells/bassist_cell.rb +0 -25
- data/test/app/cells/club_security.rb +0 -2
- data/test/app/cells/club_security/guard/help.html.erb +0 -1
- data/test/app/cells/club_security/guard_cell.rb +0 -6
- data/test/app/cells/club_security/medic/help.html.erb +0 -1
- data/test/app/cells/club_security/medic_cell.rb +0 -8
- data/test/app/cells/layouts/b.erb +0 -1
- data/test/app/cells/layouts/metal.html.erb +0 -1
- data/test/app/cells/rails_helper_api_test/bassist/edit.html.erb +0 -5
- data/test/app/cells/shouter/sing.html.erb +0 -1
- data/test/app/cells/song/dashboard.haml +0 -7
- data/test/app/cells/song/details.html.haml +0 -1
- data/test/app/cells/song/info.html.haml +0 -1
- data/test/app/cells/song/lyrics.html.haml +0 -6
- data/test/app/cells/song/plays.haml +0 -1
- data/test/app/cells/song/scale.haml +0 -1
- data/test/app/cells/song/show.html.haml +0 -3
- data/test/app/cells/song/title.html.haml +0 -1
- data/test/app/cells/trumpeter/promote.html.erb +0 -1
- data/test/app/cells/trumpeter_cell.rb +0 -8
- data/test/app/cells/view_model_test/comments/show.haml +0 -7
- data/test/app/concepts/record/views/layout.haml +0 -2
- data/test/app/views/shared/_dong.html.erb +0 -1
- data/test/cell_module_test.rb +0 -170
- data/test/cells_module_test.rb +0 -27
- data/test/deprecations_test.rb +0 -101
- data/test/dummy/app/helpers/application_helper.rb +0 -2
- data/test/dummy/app/views/musician/hamlet.html.haml +0 -1
- data/test/dummy/config/environments/development.rb +0 -16
- data/test/dummy/config/environments/production.rb +0 -46
- data/test/dummy/config/environments/test.rb +0 -33
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/label/app/cells/label/show.erb +0 -1
- data/test/dummy/label/app/cells/label_cell.rb +0 -5
- data/test/dummy/label/label.gemspec +0 -20
- data/test/dummy/label/lib/label.rb +0 -4
- data/test/dummy/label/lib/label/version.rb +0 -3
- data/test/dummy/public/404.html +0 -26
- data/test/dummy/public/422.html +0 -26
- data/test/dummy/public/500.html +0 -26
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/public/stylesheets/.gitkeep +0 -0
- data/test/helper_test.rb +0 -81
- data/test/rack_test.rb +0 -32
- data/test/rails/asset_pipeline_test.rb +0 -20
- data/test/rails/caching_test.rb +0 -456
- data/test/rails/cells_test.rb +0 -119
- data/test/rails/forms_test.rb +0 -75
- data/test/rails/integration_test.rb +0 -299
- data/test/rails/render_test.rb +0 -189
- data/test/rails/view_model_test.rb +0 -226
- data/test/rails/view_test.rb +0 -49
- data/test/rails_helper_api_test.rb +0 -58
- data/test/self_contained_test.rb +0 -31
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Dong!
|
data/test/cell_module_test.rb
DELETED
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
require 'test_helper'
|
|
2
|
-
|
|
3
|
-
class MusicianCell < Cell::Rails
|
|
4
|
-
end
|
|
5
|
-
|
|
6
|
-
class PianistCell < MusicianCell
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
class SingerCell < MusicianCell
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
# Used in CellBaseTest.
|
|
13
|
-
class ShouterCell < Cell::Base
|
|
14
|
-
def sing(first)
|
|
15
|
-
first + render
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
class CellBaseTest < MiniTest::Spec
|
|
21
|
-
it "still have a working #url_for" do
|
|
22
|
-
cell = Cell::Base.new
|
|
23
|
-
cell.instance_eval do
|
|
24
|
-
# You can use #default_url_options.
|
|
25
|
-
def default_url_options
|
|
26
|
-
{:host => "cells-project.org"}
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
end
|
|
30
|
-
# You could also use a *_url or *_path helper method here.
|
|
31
|
-
assert_equal "http://cells-project.org/dashboard/show", cell.url_for(:action => :show, :controller => :dashboard)
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
describe ".render_cell_for" do
|
|
35
|
-
it "invokes controller-less cell" do
|
|
36
|
-
Cell::Base.view_paths= ["test/app/cells"]
|
|
37
|
-
assert_equal "YAAAaaargh!\n", Cell::Base.render_cell_for(:shouter, :sing, "Y")
|
|
38
|
-
end
|
|
39
|
-
end
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
class CellModuleTest < MiniTest::Spec
|
|
44
|
-
include Cell::TestCase::TestMethods
|
|
45
|
-
describe "Cell::Rails" do
|
|
46
|
-
# FUNCTIONAL:
|
|
47
|
-
describe "render_cell_for" do
|
|
48
|
-
it "render the actual cell" do
|
|
49
|
-
assert_equal "Doo", Cell::Rails.render_cell_for(:bassist, :play, @controller)
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
it "accept a block, passing the cell instance" do
|
|
53
|
-
flag = false
|
|
54
|
-
html = Cell::Rails.render_cell_for(:bassist, :play, @controller) do |cell|
|
|
55
|
-
assert_equal BassistCell, cell.class
|
|
56
|
-
flag = true
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
assert_equal "Doo", html
|
|
60
|
-
assert flag
|
|
61
|
-
end
|
|
62
|
-
end
|
|
63
|
-
|
|
64
|
-
describe "cell_for" do
|
|
65
|
-
it "call the cell's builders, eventually returning a different class" do
|
|
66
|
-
class DrummerCell < BassistCell
|
|
67
|
-
build do
|
|
68
|
-
BassistCell
|
|
69
|
-
end
|
|
70
|
-
end
|
|
71
|
-
|
|
72
|
-
assert_instance_of BassistCell, Cell::Rails.cell_for("cell_module_test/drummer", :play, @controller)
|
|
73
|
-
end
|
|
74
|
-
end
|
|
75
|
-
|
|
76
|
-
describe "#cell_for with #build" do
|
|
77
|
-
before do
|
|
78
|
-
@controller.class_eval do
|
|
79
|
-
attr_accessor :bassist
|
|
80
|
-
end
|
|
81
|
-
|
|
82
|
-
MusicianCell.build do
|
|
83
|
-
BassistCell if bassist
|
|
84
|
-
end
|
|
85
|
-
end
|
|
86
|
-
|
|
87
|
-
after do
|
|
88
|
-
MusicianCell.class_eval do
|
|
89
|
-
@builders = false
|
|
90
|
-
end
|
|
91
|
-
BassistCell.class_eval do
|
|
92
|
-
@builders = false
|
|
93
|
-
end
|
|
94
|
-
end
|
|
95
|
-
|
|
96
|
-
it "execute the block in controller describe" do
|
|
97
|
-
@controller.bassist = true
|
|
98
|
-
assert_is_a BassistCell, Cell::Rails.cell_for(:musician, @controller)
|
|
99
|
-
end
|
|
100
|
-
|
|
101
|
-
it "limit the builder to the receiving class" do
|
|
102
|
-
assert_is_a PianistCell, Cell::Rails.cell_for(:pianist, @controller) # don't inherit anything.
|
|
103
|
-
@controller.bassist = true
|
|
104
|
-
assert_is_a BassistCell, Cell::Rails.cell_for(:musician, @controller)
|
|
105
|
-
end
|
|
106
|
-
|
|
107
|
-
it "chain build blocks and execute them by ORing them in the same order" do
|
|
108
|
-
MusicianCell.build do
|
|
109
|
-
PianistCell unless bassist
|
|
110
|
-
end
|
|
111
|
-
|
|
112
|
-
MusicianCell.build do
|
|
113
|
-
UnknownCell # it never be executed.
|
|
114
|
-
end
|
|
115
|
-
|
|
116
|
-
assert_is_a PianistCell, Cell::Rails.cell_for(:musician, @controller) # bassist is false.
|
|
117
|
-
@controller.bassist = true
|
|
118
|
-
assert_is_a BassistCell, Cell::Rails.cell_for(:musician, @controller)
|
|
119
|
-
end
|
|
120
|
-
|
|
121
|
-
it "use the original cell if no builder matches" do
|
|
122
|
-
assert_is_a MusicianCell, Cell::Rails.cell_for(:musician, @controller) # bassist is false.
|
|
123
|
-
end
|
|
124
|
-
|
|
125
|
-
it "stop at the first builder returning a valid cell" do
|
|
126
|
-
|
|
127
|
-
end
|
|
128
|
-
|
|
129
|
-
it "pass options to the block" do
|
|
130
|
-
BassistCell.build do |opts|
|
|
131
|
-
SingerCell if opts[:sing_the_song]
|
|
132
|
-
end
|
|
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
|
-
end
|
|
136
|
-
|
|
137
|
-
it "create the original target class if no block matches" do
|
|
138
|
-
assert_kind_of PianistCell, Cell::Rails.cell_for(:pianist, @controller)
|
|
139
|
-
end
|
|
140
|
-
|
|
141
|
-
it "builders it return an empty array per default" do
|
|
142
|
-
assert_equal [], PianistCell.send(:builders)
|
|
143
|
-
end
|
|
144
|
-
end
|
|
145
|
-
|
|
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
|
|
151
|
-
end
|
|
152
|
-
|
|
153
|
-
if Cell.rails_version.~("3.0")
|
|
154
|
-
it "provide possible_paths_for_state" do
|
|
155
|
-
assert_equal ["bad_guitarist/play", "bassist/play"], cell(:bad_guitarist).send(:possible_paths_for_state, :play)
|
|
156
|
-
end
|
|
157
|
-
|
|
158
|
-
it "provide Cell.cell_name" do
|
|
159
|
-
assert_equal 'bassist', cell(:bassist).class.cell_name
|
|
160
|
-
end
|
|
161
|
-
|
|
162
|
-
it "provide cell_name for modules, too" do
|
|
163
|
-
class SingerCell < Cell::Rails
|
|
164
|
-
end
|
|
165
|
-
|
|
166
|
-
assert_equal "cell_module_test/singer", CellModuleTest::SingerCell.cell_name
|
|
167
|
-
end
|
|
168
|
-
end
|
|
169
|
-
end
|
|
170
|
-
end
|
data/test/cells_module_test.rb
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
require 'test_helper'
|
|
2
|
-
|
|
3
|
-
class CellsModuleTest < MiniTest::Spec
|
|
4
|
-
describe "Cells" do
|
|
5
|
-
describe "#view_paths" do
|
|
6
|
-
before do
|
|
7
|
-
@old_view_paths = Cell::Rails.view_paths.clone
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
after do
|
|
11
|
-
Cell::Rails.view_paths = @old_view_paths
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
it "provide .before" do
|
|
15
|
-
Cells.setup do |c|
|
|
16
|
-
c.append_view_path "/road/to/nowhere"
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
if Cell.rails_version >= ("3.2")
|
|
20
|
-
assert_equal "/road/to/nowhere", Cell::Rails.view_paths.paths.last.to_s
|
|
21
|
-
else
|
|
22
|
-
assert_equal "/road/to/nowhere", Cell::Rails.view_paths.last.to_s
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
end
|
data/test/deprecations_test.rb
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
require 'test_helper'
|
|
2
|
-
|
|
3
|
-
class SongwriterCell < BassistCell
|
|
4
|
-
include Cell::Deprecations
|
|
5
|
-
end
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
class DeprecationsTest < MiniTest::Spec
|
|
9
|
-
include Cell::TestCase::TestMethods
|
|
10
|
-
|
|
11
|
-
describe "#render_state" do
|
|
12
|
-
it "work without args and provide #options" do
|
|
13
|
-
SongwriterCell.class_eval do
|
|
14
|
-
def listen
|
|
15
|
-
render :text => options[:note]
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
assert_equal "D", cell(:songwriter, :note => "D").render_state(:listen)
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
include ActiveSupport::Testing::Deprecation
|
|
22
|
-
it "mark @options as deprecated, but still work" do
|
|
23
|
-
res = nil
|
|
24
|
-
assert_deprecated do
|
|
25
|
-
res = cell(:songwriter, :song => "Lockdown").instance_eval do
|
|
26
|
-
options[:song]
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
assert_equal "Lockdown", res
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
describe "render_cell_for" do
|
|
34
|
-
it "make options available in #options if not receiving state-args" do
|
|
35
|
-
SongwriterCell.class_eval do
|
|
36
|
-
def listen
|
|
37
|
-
render :text => options[:note]
|
|
38
|
-
end
|
|
39
|
-
end
|
|
40
|
-
assert_equal "C-minor", Cell::Rails.render_cell_for(:songwriter, :listen, @controller, :note => "C-minor")
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
it "pass options as state-args and still set #options otherwise" do
|
|
44
|
-
SongwriterCell.class_eval do
|
|
45
|
-
def listen(args)
|
|
46
|
-
render :text => args[:note] + options[:note].to_s
|
|
47
|
-
end
|
|
48
|
-
end
|
|
49
|
-
assert_equal "C-minorC-minor", Cell::Rails.render_cell_for(:songwriter, :listen, @controller, :note => "C-minor")
|
|
50
|
-
end
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
describe "#state_accepts_args?" do
|
|
54
|
-
it "be false if state doesn't want args" do
|
|
55
|
-
assert_not cell(:songwriter).state_accepts_args?(:play)
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
it "be true for one arg" do
|
|
59
|
-
assert(cell(:songwriter) do
|
|
60
|
-
def listen(args) end
|
|
61
|
-
end.state_accepts_args?(:listen))
|
|
62
|
-
end
|
|
63
|
-
|
|
64
|
-
it "be true for multiple arg" do
|
|
65
|
-
assert(cell(:songwriter) do
|
|
66
|
-
def listen(what, where) end
|
|
67
|
-
end.state_accepts_args?(:listen))
|
|
68
|
-
end
|
|
69
|
-
|
|
70
|
-
it "be true for multiple arg with defaults" do
|
|
71
|
-
assert(cell(:songwriter) do
|
|
72
|
-
def listen(what, where="") end
|
|
73
|
-
end.state_accepts_args?(:listen))
|
|
74
|
-
end
|
|
75
|
-
end
|
|
76
|
-
|
|
77
|
-
describe ".cache" do
|
|
78
|
-
after do
|
|
79
|
-
ActionController::Base.perform_caching = false
|
|
80
|
-
end
|
|
81
|
-
|
|
82
|
-
it "still be able to use options in the block" do
|
|
83
|
-
ActionController::Base.perform_caching = true
|
|
84
|
-
|
|
85
|
-
SongwriterCell.class_eval do
|
|
86
|
-
def count(args)
|
|
87
|
-
render :text => args[:int]
|
|
88
|
-
end
|
|
89
|
-
|
|
90
|
-
cache :count do |i|
|
|
91
|
-
(options[:int] % 2)==0 ? {:count => "even"} : {:count => "odd"}
|
|
92
|
-
end
|
|
93
|
-
end
|
|
94
|
-
|
|
95
|
-
assert_equal "1", render_cell(:songwriter, :count, :int => 1)
|
|
96
|
-
assert_equal "2", render_cell(:songwriter, :count, :int => 2)
|
|
97
|
-
assert_equal "1", render_cell(:songwriter, :count, :int => 3)
|
|
98
|
-
assert_equal "2", render_cell(:songwriter, :count, :int => 4)
|
|
99
|
-
end
|
|
100
|
-
end
|
|
101
|
-
end
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
= render_cell :bassist, :provoke
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
Dummy::Application.configure do
|
|
2
|
-
# Settings specified here will take precedence over those in config/environment.rb
|
|
3
|
-
|
|
4
|
-
# In the development environment your application's code is reloaded on
|
|
5
|
-
# every request. This slows down response time but is perfect for development
|
|
6
|
-
# since you don't have to restart the webserver when you make code changes.
|
|
7
|
-
config.cache_classes = false
|
|
8
|
-
|
|
9
|
-
# Log error messages when you accidentally call methods on nil.
|
|
10
|
-
config.whiny_nils = true
|
|
11
|
-
|
|
12
|
-
# Show full error reports and disable caching
|
|
13
|
-
config.consider_all_requests_local = true
|
|
14
|
-
config.action_view.debug_rjs = true
|
|
15
|
-
config.action_controller.perform_caching = false
|
|
16
|
-
end
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
Dummy::Application.configure do
|
|
2
|
-
# Settings specified here will take precedence over those in config/environment.rb
|
|
3
|
-
|
|
4
|
-
# The production environment is meant for finished, "live" apps.
|
|
5
|
-
# Code is not reloaded between requests
|
|
6
|
-
config.cache_classes = true
|
|
7
|
-
|
|
8
|
-
# Full error reports are disabled and caching is turned on
|
|
9
|
-
config.consider_all_requests_local = false
|
|
10
|
-
config.action_controller.perform_caching = true
|
|
11
|
-
|
|
12
|
-
# Specifies the header that your server uses for sending files
|
|
13
|
-
config.action_dispatch.x_sendfile_header = "X-Sendfile"
|
|
14
|
-
|
|
15
|
-
# For nginx:
|
|
16
|
-
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'
|
|
17
|
-
|
|
18
|
-
# If you have no front-end server that supports something like X-Sendfile,
|
|
19
|
-
# just comment this out and Rails will serve the files
|
|
20
|
-
|
|
21
|
-
# See everything in the log (default is :info)
|
|
22
|
-
# config.log_level = :debug
|
|
23
|
-
|
|
24
|
-
# Use a different logger for distributed setups
|
|
25
|
-
# config.logger = SyslogLogger.new
|
|
26
|
-
|
|
27
|
-
# Use a different cache store in production
|
|
28
|
-
# config.cache_store = :mem_cache_store
|
|
29
|
-
|
|
30
|
-
# Disable Rails's static asset server
|
|
31
|
-
# In production, Apache or nginx will already do this
|
|
32
|
-
config.serve_static_assets = false
|
|
33
|
-
|
|
34
|
-
# Enable serving of images, stylesheets, and javascripts from an asset server
|
|
35
|
-
# config.action_controller.asset_host = "http://assets.example.com"
|
|
36
|
-
|
|
37
|
-
# Disable delivery errors, bad email addresses will be ignored
|
|
38
|
-
# config.action_mailer.raise_delivery_errors = false
|
|
39
|
-
|
|
40
|
-
# Enable threaded mode
|
|
41
|
-
# config.threadsafe!
|
|
42
|
-
|
|
43
|
-
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
|
44
|
-
# the I18n.default_locale when a translation can not be found)
|
|
45
|
-
config.i18n.fallbacks = true
|
|
46
|
-
end
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
Dummy::Application.configure do
|
|
2
|
-
# Settings specified here will take precedence over those in config/environment.rb
|
|
3
|
-
|
|
4
|
-
# The test environment is used exclusively to run your application's
|
|
5
|
-
# test suite. You never need to work with it otherwise. Remember that
|
|
6
|
-
# your test database is "scratch space" for the test suite and is wiped
|
|
7
|
-
# and recreated between test runs. Don't rely on the data there!
|
|
8
|
-
config.cache_classes = true
|
|
9
|
-
|
|
10
|
-
# Log error messages when you accidentally call methods on nil.
|
|
11
|
-
config.whiny_nils = true
|
|
12
|
-
|
|
13
|
-
# Show full error reports and disable caching
|
|
14
|
-
config.consider_all_requests_local = true
|
|
15
|
-
config.action_controller.perform_caching = false
|
|
16
|
-
|
|
17
|
-
# Raise exceptions instead of rendering exception templates
|
|
18
|
-
config.action_dispatch.show_exceptions = false
|
|
19
|
-
|
|
20
|
-
# Disable request forgery protection in test environment
|
|
21
|
-
config.action_controller.allow_forgery_protection = false
|
|
22
|
-
config.secret_key_base = "yo"
|
|
23
|
-
|
|
24
|
-
# Tell Action Mailer not to deliver emails to the real world.
|
|
25
|
-
# The :test delivery method accumulates sent emails in the
|
|
26
|
-
# ActionMailer::Base.deliveries array.
|
|
27
|
-
#config.action_mailer.delivery_method = :test
|
|
28
|
-
|
|
29
|
-
# Use SQL instead of Active Record's schema dumper when creating the test database.
|
|
30
|
-
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
|
31
|
-
# like if you have constraints or database-specific column types
|
|
32
|
-
# config.active_record.schema_format = :sql
|
|
33
|
-
end
|
data/test/dummy/db/test.sqlite3
DELETED
|
File without changes
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Fat Wreck
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
$:.push File.expand_path("../lib", __FILE__)
|
|
2
|
-
|
|
3
|
-
# Maintain your gem's version:
|
|
4
|
-
require "label/version"
|
|
5
|
-
|
|
6
|
-
# Describe your gem and declare its dependencies:
|
|
7
|
-
Gem::Specification.new do |s|
|
|
8
|
-
s.name = "label"
|
|
9
|
-
s.version = Label::VERSION
|
|
10
|
-
s.authors = ["Nick"]
|
|
11
|
-
s.email = ["apotonick@gmail.com"]
|
|
12
|
-
s.homepage = "TODO"
|
|
13
|
-
s.summary = "TODO: Summary of Label."
|
|
14
|
-
s.description = "TODO: Description of Label."
|
|
15
|
-
|
|
16
|
-
s.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.rdoc"]
|
|
17
|
-
s.test_files = Dir["test/**/*"]
|
|
18
|
-
|
|
19
|
-
#s.add_dependency "railties", ">= 4.0.0"
|
|
20
|
-
end
|