cells 4.0.0.beta3 → 4.0.0.beta4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 442134126a42a17ae056d6fea0138663b6868801
4
- data.tar.gz: 78b1ebe96cb15081e067f62a10208648a71388b4
3
+ metadata.gz: 57a798a4273783ab7f1deffc6939d0ac6b619984
4
+ data.tar.gz: 5a2456cabe4d16534dd86ee2036c834c6c11ea45
5
5
  SHA512:
6
- metadata.gz: 8278561d5102e21559df5a51c852d74c6bc2b017db2d35d933a504ec8d5c521851c1179f5c5ac0d2f8f950be764233c4b4bf26750b59103639c2da96c2b36886
7
- data.tar.gz: a3ee11a160976a710b93ed9e2ca1705ef64d34c1bc1d0b8c303932cd6a2f22a62898814a25e5897ce757664fae84c9d9da070e5dcc4fe9e55a89b9e9ad8d0b42
6
+ metadata.gz: 96f18c5cd146d90ce0595e3d46c1f1daca73c0f0b75bafb5e8e0b247124fbc89db6f42dfdc2f4dd7c05b4db95ab6b1c6b670e82ef6b14448c754bb70243b7d50
7
+ data.tar.gz: 4f2340f3263885ba1d4a2fa738c7e35132a6a6bc07b23a0ccd373a09b8e4d6aaecc300e314e50ced135e17d1aa7d870ce8a10bef9b6392ce9e4a54299c3edb7a
data/CHANGES.md CHANGED
@@ -18,6 +18,12 @@
18
18
 
19
19
  * When using HAML, we do not use any of HAML's helper hacks to "fix" ActionView and XSS. While you might not note this, it removes tons of code from our stack.
20
20
 
21
+ ## 4.0.0.beta4
22
+
23
+ * Fixed a bug when rendering more than once with ERB, the output buffer was being reused.
24
+ * API change: ViewModel::_prefixes now returns the "fully qualified" pathes including the view paths, prepended to the prefixes. This allows multiple view paths and basically fixes cells in engines.
25
+ * The only public way to retrieve prefixes for a cell is `ViewModel::prefixes`. The result is cached.
26
+
21
27
  ## 4.0.0.beta3
22
28
 
23
29
  * Introduce `Cell::Testing` for Rspec and MiniTest.
data/Gemfile CHANGED
@@ -1,10 +1,8 @@
1
- source 'https://rubygems.org'
1
+ source "https://rubygems.org"
2
2
 
3
- gemspec
4
-
5
- gem 'minitest-reporters'
6
- gem 'pry-byebug' , platforms: [:mri_20, :mri_21]
7
- gem 'appraisal'
8
- gem 'rake'
9
- gem 'test_xml'
3
+ gem "railties", "~> 4.2.0"
4
+ gem "activemodel", "~> 4.2.0"
5
+ gem "minitest", "~> 5.2"
6
+ gem "cells-erb", path: "../cells-erb"
10
7
 
8
+ gemspec
data/cells.gemspec CHANGED
@@ -24,7 +24,10 @@ Gem::Specification.new do |spec|
24
24
  spec.add_dependency 'tilt', '>= 1.4', '< 3'
25
25
  spec.add_dependency 'disposable', '~> 0.0.8'
26
26
 
27
- spec.add_dependency "capybara"
27
+
28
+ spec.add_development_dependency "rake"
29
+ spec.add_development_dependency "minitest-reporters"
30
+ spec.add_development_dependency "capybara"
28
31
 
29
32
  spec.add_development_dependency "cells-erb", ">= 0.0.2"
30
33
  end
@@ -2,11 +2,6 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "minitest-reporters"
6
- gem "pry-byebug", :platforms => [:mri_20, :mri_21]
7
- gem "appraisal"
8
- gem "rake"
9
- gem "test_xml"
10
5
  gem "railties", "~> 3.2.0"
11
6
  gem "tzinfo"
12
7
  gem "minitest", "4.7.5"
@@ -2,11 +2,6 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "minitest-reporters"
6
- gem "pry-byebug", :platforms => [:mri_20, :mri_21]
7
- gem "appraisal"
8
- gem "rake"
9
- gem "test_xml"
10
5
  gem "railties", "4.0.12"
11
6
  gem "activemodel"
12
7
  gem "minitest", "4.7.5"
@@ -2,12 +2,6 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "minitest-reporters"
6
- gem "pry-byebug", :platforms => [:mri_20, :mri_21]
7
- gem "appraisal"
8
- gem "rake"
9
- gem "test_xml"
10
-
11
5
  gem "railties", "~> 4.1.0" #, :github => "rails/rails", :branch => "4-1-stable"
12
6
  gem "activemodel", "~> 4.1.0" #, :github => "rails/rails", :branch => "4-1-stable"
13
7
  gem "minitest", "~> 5.2"
data/lib/cell.rb CHANGED
@@ -16,8 +16,8 @@ module Cell
16
16
  end
17
17
 
18
18
  class TemplateMissingError < RuntimeError
19
- def initialize(base, prefixes, view, engine, formats)
20
- super("Template missing: view: `#{view.to_s}.#{engine}` prefixes: #{prefixes.inspect} view_paths:#{base.inspect}")
19
+ def initialize(prefixes, view, engine, formats)
20
+ super("Template missing: view: `#{view.to_s}.#{engine}` prefixes: #{prefixes.inspect}")
21
21
  end
22
22
  end # Error
23
23
  end
data/lib/cell/partial.rb CHANGED
@@ -10,7 +10,7 @@ module Cell::ViewModel::Partial
10
10
  view = parts.pop
11
11
  view = "_#{view}"
12
12
  view += ".#{options[:formats].first}" if options[:formats]
13
- prefixes = [parts.join("/")]
13
+ prefixes = self.class.view_paths.collect { |path| parts.unshift(path).join("/") }
14
14
 
15
15
  options.merge!(:view => view, :prefixes => prefixes)
16
16
  end
data/lib/cell/prefixes.rb CHANGED
@@ -1,26 +1,31 @@
1
- # TODO: merge into Rails core.
2
1
  # TODO: cache _prefixes on class layer.
3
2
  module Cell::Prefixes
4
3
  extend ActiveSupport::Concern
5
4
 
6
5
  def _prefixes
7
- self.class._prefixes
6
+ self.class.prefixes
8
7
  end
9
8
 
9
+ # You're free to override those methods in case you want to alter our view inheritance.
10
10
  module ClassMethods
11
+ def prefixes
12
+ @prefixes ||= _prefixes
13
+ end
14
+
15
+ private
11
16
  def _prefixes
12
17
  return [] if abstract?
13
- _local_prefixes + superclass._prefixes
18
+ _local_prefixes + superclass.prefixes
14
19
  end
15
20
 
16
21
  def _local_prefixes
17
- [controller_path]
22
+ view_paths.collect { |path| "#{path}/#{controller_path}" }
18
23
  end
19
24
 
20
25
  # Instructs Cells to inherit views from a parent cell without having to inherit class code.
21
26
  def inherit_views(parent)
22
27
  define_method :_prefixes do
23
- super() + parent._prefixes
28
+ super() + parent.prefixes
24
29
  end
25
30
  end
26
31
  end
data/lib/cell/rails.rb CHANGED
@@ -1,5 +1,4 @@
1
- # These Methods are automatically added to all Controllers and Views when
2
- # the cells plugin is loaded.
1
+ # These methods are automatically added to all controllers and views.
3
2
  module Cell
4
3
  module RailsExtensions
5
4
  module ActionController
@@ -10,44 +9,6 @@ module Cell
10
9
  def concept(name, *args, &block)
11
10
  Concept.cell(name, self, *args, &block)
12
11
  end
13
-
14
- # # Renders the cell state and returns the content. You may pass options here, too. They will be
15
- # # around in @opts.
16
- # #
17
- # # Example:
18
- # #
19
- # # @box = render_cell(:posts, :latest, :user => current_user)
20
- # #
21
- # # If you need the cell instance before it renders, you can pass a block receiving the cell.
22
- # #
23
- # # Example:
24
- # #
25
- # # @box = render_cell(:comments, :top5) do |cell|
26
- # # cell.markdown! if config.parse_comments?
27
- # # end
28
- # def render_cell(name, state, *args, &block)
29
- # ::Cell::Rails.render_cell(name, state, self, *args, &block)
30
- # end
31
-
32
- # # Expires the cached cell state view, similar to ActionController::expire_fragment.
33
- # # Usually, this method is used in Sweepers.
34
- # # Beside the obvious first two args <tt>cell_name</tt> and <tt>state</tt> you can pass
35
- # # in additional cache key <tt>args</tt> and cache store specific <tt>opts</tt>.
36
- # #
37
- # # Example:
38
- # #
39
- # # class ListSweeper < ActionController::Caching::Sweeper
40
- # # observe List, Item
41
- # #
42
- # # def after_save(record)
43
- # # expire_cell_state :my_listing, :display_list
44
- # # end
45
- # #
46
- # # will expire the view for state <tt>:display_list</tt> in the cell <tt>MyListingCell</tt>.
47
- # def expire_cell_state(cell_class, state, args={}, opts=nil)
48
- # key = cell_class.state_cache_key(state, args)
49
- # cell_class.expire_cache_key(key, opts)
50
- # end
51
12
  end
52
13
 
53
14
  module ActionView
@@ -2,10 +2,10 @@ module Cell
2
2
  # Gets cached in production.
3
3
  class Templates
4
4
  # prefixes could be instance variable as they will never change.
5
- def [](bases, prefixes, view, engine, formats=nil)
6
- base = bases.first # FIXME.
5
+ def [](prefixes, view, engine, formats=nil)
6
+ view = "#{view}.#{engine}"
7
7
 
8
- find_template(base, prefixes, view, engine)
8
+ find_template(prefixes, view, engine)
9
9
  end
10
10
 
11
11
  private
@@ -14,19 +14,17 @@ module Cell
14
14
  @cache ||= Cache.new
15
15
  end
16
16
 
17
- def find_template(base, prefixes, view, engine)
18
- view = "#{view}.#{engine}"
19
-
17
+ def find_template(prefixes, view, engine)
20
18
  cache.fetch(prefixes, view) do |prefix|
21
19
  # this block is run once per cell class per process, for each prefix/view tuple.
22
- create(base, prefix, view)
20
+ create(prefix, view)
23
21
  end
24
22
  end
25
23
 
26
- def create(base, prefix, view)
27
- # puts "...checking #{base}/#{prefix}/#{view}"
28
- return unless File.exists?("#{base}/#{prefix}/#{view}") # DISCUSS: can we use Tilt.new here?
29
- Tilt.new("#{base}/#{prefix}/#{view}", :escape_html => false, :escape_attrs => false)
24
+ def create(prefix, view)
25
+ # puts "...checking #{prefix}/#{view}"
26
+ return unless File.exists?("#{prefix}/#{view}") # DISCUSS: can we use Tilt.new here?
27
+ Tilt.new("#{prefix}/#{view}", escape_html: false, escape_attrs: false)
30
28
  end
31
29
 
32
30
  # {["comment/row/views", comment/views"][show.haml] => "Tpl:comment/view/show.haml"}
data/lib/cell/version.rb CHANGED
@@ -3,7 +3,7 @@ module Cell
3
3
  MAJOR = 4
4
4
  MINOR = 0
5
5
  TINY = 0
6
- PRE = "beta3"
6
+ PRE = "beta4"
7
7
 
8
8
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
9
9
  end
@@ -7,6 +7,8 @@ require 'action_controller'
7
7
  # options are automatically made instance methods via constructor.
8
8
  # call "helpers" in class
9
9
 
10
+ # TODO: CACHE prefixes.
11
+
10
12
  # TODO: warn when using ::property but not passing in model in constructor.
11
13
  module Cell
12
14
  class ViewModel < AbstractController::Base
@@ -16,7 +18,7 @@ module Cell
16
18
  extend Uber::Delegates
17
19
 
18
20
  inheritable_attr :view_paths
19
- self.view_paths = ["app/cells"] # DISCUSS: provide same API as rails?
21
+ self.view_paths = ["app/cells"]
20
22
 
21
23
  inheritable_attr :template_engine
22
24
  self.template_engine = "erb"
@@ -163,20 +165,20 @@ module Cell
163
165
  end
164
166
  end
165
167
  def output_buffer # called from the precompiled template. FIXME: this is currently not used in Haml.
166
- @output_buffer ||= OutputBuffer.new
168
+ OutputBuffer.new # don't cache output_buffer, for every render call we get a fresh one.
167
169
  end
168
170
  attr_writer :output_buffer # FIXME: where is that used? definitely not in Erbse.
171
+ # TODO: remove output_buffer in favor or returning the string.
169
172
 
170
173
 
171
174
  module TemplateFor
172
175
  def template_for(options)
173
176
  view = options[:view]
174
177
  engine = options[:template_engine]
175
- base = options[:base]
176
178
  prefixes = options[:prefixes]
177
179
 
178
180
  # we could also pass _prefixes when creating class.templates, because prefixes are never gonna change per instance. not too sure if i'm just assuming this or if people need that.
179
- self.class.templates[base, prefixes, view, engine] or raise TemplateMissingError.new(base, prefixes, view, engine, nil)
181
+ self.class.templates[prefixes, view, engine] or raise TemplateMissingError.new(prefixes, view, engine, nil)
180
182
  end
181
183
  end
182
184
  include TemplateFor
@@ -190,13 +192,12 @@ module Cell
190
192
 
191
193
  def normalize_options(options, caller) # TODO: rename to #setup_options! to be inline with Trb.
192
194
  options = if options.is_a?(Hash)
193
- options.reverse_merge(:view => state_for_implicit_render(caller)) # TODO: test implicit render!
195
+ options.reverse_merge(:view => state_for_implicit_render(caller))
194
196
  else
195
197
  {:view => options.to_s}
196
198
  end
197
199
 
198
200
  options[:template_engine] ||= self.class.template_engine # DISCUSS: in separate method?
199
- options[:base] ||= self.class.view_paths
200
201
  options[:prefixes] ||= _prefixes
201
202
 
202
203
  process_options!(options)
data/test/concept_test.rb CHANGED
@@ -40,9 +40,9 @@ class ConceptTest < MiniTest::Spec
40
40
 
41
41
 
42
42
  describe "#_prefixes" do
43
- it { Record::Cell.new(@controller)._prefixes.must_equal ["record/views"] }
44
- it { Record::Cell::Song.new(@controller)._prefixes.must_equal ["record/song/views", "record/views"] }
45
- it { Record::Cell::Hit.new(@controller)._prefixes.must_equal ["record/hit/views", "record/views"] } # with inherit_views.
43
+ it { Record::Cell.new(@controller)._prefixes.must_equal ["test/fixtures/concepts/record/views"] }
44
+ it { Record::Cell::Song.new(@controller)._prefixes.must_equal ["test/fixtures/concepts/record/song/views", "test/fixtures/concepts/record/views"] }
45
+ it { Record::Cell::Hit.new(@controller)._prefixes.must_equal ["test/fixtures/concepts/record/hit/views", "test/fixtures/concepts/record/views"] } # with inherit_views.
46
46
  end
47
47
 
48
48
  it { Record::Cell.new(@controller, "Wayne").call(:show).must_equal "Party on, Wayne!" }
@@ -6,6 +6,18 @@ end
6
6
  class BassistCell::IbanezCell < BassistCell
7
7
  end
8
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
+
9
21
  class PrefixesTest < MiniTest::Spec
10
22
  class SingerCell < Cell::ViewModel
11
23
  end
@@ -35,17 +47,35 @@ class PrefixesTest < MiniTest::Spec
35
47
  end
36
48
 
37
49
  describe "#_prefixes" do
38
- it { ::BassistCell.new(@controller)._prefixes.must_equal ["bassist"] }
39
- it { ::BassistCell::FenderCell.new(@controller)._prefixes.must_equal ["bassist_cell/fender"] }
40
- it { ::BassistCell::IbanezCell.new(@controller)._prefixes.must_equal ["bassist_cell/ibanez", "bassist"] }
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"] }
41
53
 
42
- it { SingerCell.new(@controller)._prefixes.must_equal ["prefixes_test/singer"] }
43
- it { BackgroundVocalsCell.new(@controller)._prefixes.must_equal ["prefixes_test/background_vocals", "prefixes_test/singer"] }
44
- it { ChorusCell.new(@controller)._prefixes.must_equal ["prefixes_test/chorus", "prefixes_test/background_vocals", "prefixes_test/singer"] }
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"] }
45
57
 
46
- it { GuitaristCell.new(@controller)._prefixes.must_equal ["stringer", "prefixes_test/singer"] }
47
- it { BassistCell.new(@controller)._prefixes.must_equal ["prefixes_test/bassist", "basser", "prefixes_test/singer"] }
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"] }
48
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
49
79
  end
50
80
 
51
81
  # it { Record::Cell.new(@controller).render_state(:show).must_equal "Rock on!" }
@@ -65,8 +95,8 @@ class InheritViewsTest < MiniTest::Spec
65
95
  class FunkerCell < SlapperCell
66
96
  end
67
97
 
68
- it { SlapperCell.new(nil)._prefixes.must_equal ["inherit_views_test/slapper", "bassist"] }
69
- it { FunkerCell.new(nil)._prefixes.must_equal ["inherit_views_test/funker", "inherit_views_test/slapper", "bassist"] }
98
+ it { SlapperCell.new(nil)._prefixes.must_equal ["test/fixtures/inherit_views_test/slapper", "test/fixtures/bassist"] }
99
+ it { FunkerCell.new(nil)._prefixes.must_equal ["test/fixtures/inherit_views_test/funker", "test/fixtures/inherit_views_test/slapper", "test/fixtures/bassist"] }
70
100
 
71
101
  # test if normal cells inherit views.
72
102
  it { cell('inherit_views_test/slapper').play.must_equal 'Doo' }
data/test/render_test.rb CHANGED
@@ -49,7 +49,7 @@ private
49
49
  end
50
50
 
51
51
  class RenderTest < MiniTest::Spec
52
- # render show.haml calling method.
52
+ # render show.haml calling method, implicit render.
53
53
  it { SongCell.new(nil).show.must_equal "Papertiger\n" }
54
54
 
55
55
  # render ivar.haml using instance variable.
@@ -70,7 +70,7 @@ class RenderTest < MiniTest::Spec
70
70
  # throws an exception when not found.
71
71
  it do
72
72
  exception = assert_raises(Cell::TemplateMissingError) { SongCell.new(nil).unknown }
73
- exception.message.must_equal "Template missing: view: `unknown.erb` prefixes: [\"song\"] view_paths:[\"test/fixtures\"]"
73
+ exception.message.must_equal "Template missing: view: `unknown.erb` prefixes: [\"test/fixtures/song\"]"
74
74
  end
75
75
 
76
76
  # allows locals
@@ -4,13 +4,11 @@ require 'test_helper'
4
4
  class TemplatesTest < MiniTest::Spec
5
5
  Templates = Cell::Templates
6
6
 
7
- let (:base) { ['test/fixtures'] }
8
-
9
7
  # existing.
10
- it { Templates.new[base, ['bassist'], 'play', 'erb'].file.must_equal 'test/fixtures/bassist/play.erb' }
8
+ it { Templates.new[['test/fixtures/bassist'], 'play', 'erb'].file.must_equal 'test/fixtures/bassist/play.erb' }
11
9
 
12
10
  # not existing.
13
- it { Templates.new[base, ['bassist'], 'not-here', 'erb'].must_equal nil }
11
+ it { Templates.new[['test/fixtures/bassist'], 'not-here', 'erb'].must_equal nil }
14
12
 
15
13
 
16
14
  # different caches for different classes
data/test/test_helper.rb CHANGED
@@ -1,25 +1,21 @@
1
- begin
2
- require 'byebug'
3
- rescue LoadError
4
- end
5
-
6
1
  ENV['RAILS_ENV'] = 'test'
7
2
  require_relative 'dummy/config/environment'
8
3
 
9
4
  require 'minitest/autorun'
10
- require 'test_xml/mini_test'
11
5
 
12
6
  require 'minitest/reporters'
13
7
  Minitest::Reporters.use! [Minitest::Reporters::ProgressReporter.new]
14
8
  require "rails/test_help" # adds stuff like @routes, etc.
15
9
 
16
10
  require 'cells'
11
+ require "cells-erb"
17
12
 
18
13
  MiniTest::Spec.class_eval do
19
14
  include Cell::Testing
20
15
  end
21
16
 
22
17
  class BassistCell < Cell::ViewModel
18
+ self.view_paths = ['test/fixtures']
23
19
  end
24
20
 
25
21
  class MusicianController < ActionController::Base
@@ -6,85 +6,11 @@ end
6
6
  class UrlHelperTest < MiniTest::Spec
7
7
  controller MusiciansController
8
8
 
9
- let (:cellule) { SongCell.new(controller) }
9
+ let (:song_cell) { SongCell.new(controller) }
10
10
 
11
11
  class SongCell < Cell::ViewModel
12
- self.view_paths = ['test/fixtures']
13
-
14
- include ActionView::Helpers::FormTagHelper
15
-
16
- def edit
17
- render
18
- end
19
-
20
- def with_content_tag
21
- render
22
- end
23
-
24
- def with_block
25
- render
26
- end
27
-
28
- def with_capture
29
- render
30
- end
31
-
32
- def with_form_tag
33
- form_tag("/songs") + content_tag(:span) + "</form>"
34
- end
35
-
36
- include ActionView::Helpers::AssetTagHelper
37
- def with_link_to
38
- render
39
- end
40
-
41
- include ActionView::Helpers::FormHelper
42
- def with_form_for_block
43
- render
44
- end
45
-
46
- def erb_with_form_for_block
47
- render template_engine: :erb
48
- end
49
-
50
- private
51
- def cap
52
- "yay, #{with_output_buffer { yield } }"
53
- end
54
12
  end
55
13
 
56
-
57
14
  # URL helpers work in cell instance.
58
- it { cellule.songs_path.must_equal "/songs" }
59
- # it { cellule.url_for(Song.new).must_equal "/songs" }
60
-
61
- include TestXml::Assertions # TODO: fix in test_xml.
62
-
63
- # content_tag with HAML.
64
- # it { cellule.with_content_tag.must_equal "<span>Title:\n<div>Still Knee Deep\n</div>\n</span>\n" }
65
-
66
- # form_tag with block in block work.
67
- # it { cellule.edit.must_equal_xml_structure "<form><div><input/></div><label/><input/><ul><li/></ul></form>" }
68
-
69
- # form_tag, no block
70
- # it { cellule.with_form_tag.must_equal_xml_structure "<form><div><input/></div><span/></form>" }
71
-
72
- # # form_for with block
73
- # it { cellule.with_form_for_block.must_equal_xml_structure "<form><div><input/></div><input/></form>" }
74
- # # form_for with block in ERB.
75
- # it { cellule.erb_with_form_for_block.must_equal_xml_structure "<form><div><input/></div><input/></form>" }
76
-
77
- # when using yield, haml breaks it (but doesn't escape HTML)
78
- # it { cellule.with_block.must_equal "Nice!\nyay, <b>yeah</b>\n" }
79
-
80
- # capture
81
- # it { cellule.with_capture.must_equal "Nice!\n<b>Great!</b>\n" }
82
-
83
- # there's again escaping happening where it shouldn't be in link_to and rails <= 3.2.
84
- # if Cell.rails_version >= Gem::Version.new('4.0')
85
- # # link_to with block and img_tag
86
- # it { cellule.with_link_to.must_equal "<a href=\"/songs\"><img alt=\"All\" src=\"/images/all.png\" />\n</a>\n" }
87
- # end
15
+ it { song_cell.songs_path.must_equal "/songs" }
88
16
  end
89
-
90
- # start with content_tag and block (or capture) and find out how sinatra handles that. goal is NOT to use those hacks in haml's action_view_extensions.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cells
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0.beta3
4
+ version: 4.0.0.beta4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Sutterer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-26 00:00:00.000000000 Z
11
+ date: 2015-05-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionpack
@@ -72,6 +72,34 @@ dependencies:
72
72
  - - "~>"
73
73
  - !ruby/object:Gem::Version
74
74
  version: 0.0.8
75
+ - !ruby/object:Gem::Dependency
76
+ name: rake
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
82
+ type: :development
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ - !ruby/object:Gem::Dependency
90
+ name: minitest-reporters
91
+ requirement: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
96
+ type: :development
97
+ prerelease: false
98
+ version_requirements: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
75
103
  - !ruby/object:Gem::Dependency
76
104
  name: capybara
77
105
  requirement: !ruby/object:Gem::Requirement
@@ -79,7 +107,7 @@ dependencies:
79
107
  - - ">="
80
108
  - !ruby/object:Gem::Version
81
109
  version: '0'
82
- type: :runtime
110
+ type: :development
83
111
  prerelease: false
84
112
  version_requirements: !ruby/object:Gem::Requirement
85
113
  requirements:
@@ -110,7 +138,6 @@ extra_rdoc_files: []
110
138
  files:
111
139
  - ".gitignore"
112
140
  - ".travis.yml"
113
- - Appraisals
114
141
  - CHANGES.md
115
142
  - Gemfile
116
143
  - README.md
data/Appraisals DELETED
@@ -1,23 +0,0 @@
1
- appraise 'rails3.2' do
2
- gem 'railties', github: 'rails/rails', branch: '3-2-stable'
3
- gem 'tzinfo'
4
- gem 'minitest', '4.7.5'
5
- end
6
-
7
- appraise "rails4.0" do
8
- gem 'railties', github: 'rails/rails', branch: '4-0-stable'
9
- gem 'activemodel', github: 'rails/rails', branch: '4-0-stable'
10
- gem 'minitest', '4.7.5'
11
- end
12
-
13
- appraise "rails4.1" do
14
- gem 'railties', github: 'rails/rails', branch: '4-1-stable'
15
- gem 'activemodel', github: 'rails/rails', branch: '4-1-stable'
16
- gem 'minitest', '~> 5.2'
17
- end
18
-
19
- appraise "rails4.2" do
20
- gem 'railties', github: 'rails/rails', branch: '4-2-stable'
21
- gem 'activemodel', github: 'rails/rails', branch: '4-2-stable'
22
- gem 'minitest', '~> 5.2'
23
- end