cells 3.8.1 → 3.8.2

Sign up to get free protection for your applications and to get access to all the features.
data/.travis.yml CHANGED
@@ -3,5 +3,6 @@ notifications:
3
3
  irc: "irc.freenode.org#cells"
4
4
  gemfile:
5
5
  - Gemfile
6
+ - gemfiles/Gemfile.rails3-0
6
7
  - gemfiles/Gemfile.rails3-1
7
8
  - gemfiles/Gemfile.rails3-2
data/CHANGES.textile CHANGED
@@ -1,3 +1,7 @@
1
+ h2. 3.8.2
2
+
3
+ * Engines should work in Rails 3.0 now, too.
4
+
1
5
  h2. 3.8.1
2
6
 
3
7
  * Make it work with Rails 3.2 by removing deprecated stuff.
@@ -1,3 +1,4 @@
1
+ # This file contains VersionStrategies for the Cell and Cells module for Rails 3.0.
1
2
  module Cell
2
3
  # Methods to be included in Cell::Rails in 3.0 context, where there's no view inheritance.
3
4
  module VersionStrategy
@@ -28,7 +29,7 @@ module Cell
28
29
  # Returns all possible view paths for +state+ by invoking #view_for_state on all classes up
29
30
  # the inheritance chain.
30
31
  def find_class_view_for_state(state)
31
- return [view_for_state(state)] unless superclass.respond_to?(:find_class_view_for_state)
32
+ return [view_for_state(state)] if superclass.abstract?
32
33
 
33
34
  superclass.find_class_view_for_state(state) << view_for_state(state)
34
35
  end
@@ -67,3 +68,12 @@ module Cell
67
68
  end
68
69
  end
69
70
  end
71
+
72
+
73
+ module Cells::Engines
74
+ module VersionStrategy
75
+ def registered_engines
76
+ ::Rails::Application.railties.engines
77
+ end
78
+ end
79
+ end
@@ -1,3 +1,4 @@
1
+ # This file contains VersionStrategies for the Cell and Cells module for Rails >= 3.1.
1
2
  module Cell
2
3
  # Methods to be included in Cell::Rails in 3.1 context.
3
4
  module VersionStrategy
@@ -24,3 +25,12 @@ module Cell
24
25
  end
25
26
  end
26
27
  end
28
+
29
+
30
+ module Cells::Engines
31
+ module VersionStrategy
32
+ def registered_engines
33
+ ::Rails::Application::Railties.engines
34
+ end
35
+ end
36
+ end
data/lib/cells/engines.rb CHANGED
@@ -31,6 +31,8 @@ module Cells
31
31
  # end
32
32
  #
33
33
  module Engines
34
+ extend VersionStrategy # adds #registered_engines.
35
+
34
36
  # Appends all <tt>Rails::Engine</tt>s cell-views path to Cell::Base#view_paths
35
37
  #
36
38
  # All <tt>Rails::Engine</tt>s specified at <tt>config.view_path_engines</tt> will have its cell-views path appended to Cell::Base#view_paths
@@ -40,7 +42,7 @@ module Cells
40
42
  def self.append_engines_view_paths_for(config)
41
43
  return if config.view_path_engines == false
42
44
 
43
- engines = config.view_path_engines || ::Rails::Application::Railties.engines
45
+ engines = config.view_path_engines || registered_engines#::Rails::Application::Railties.engines
44
46
  engines.each {|engine| append_engine_view_path!(engine) }
45
47
  end
46
48
 
data/lib/cells/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Cells
2
- VERSION = '3.8.1'
2
+ VERSION = '3.8.2'
3
3
  end
@@ -151,7 +151,7 @@ class CellModuleTest < ActiveSupport::TestCase
151
151
 
152
152
  if Cells.rails3_0?
153
153
  should "provide possible_paths_for_state" do
154
- assert_equal ["bad_guitarist/play", "bassist/play", "cell/rails/play"], cell(:bad_guitarist).send(:possible_paths_for_state, :play)
154
+ assert_equal ["bad_guitarist/play", "bassist/play"], cell(:bad_guitarist).send(:possible_paths_for_state, :play)
155
155
  end
156
156
 
157
157
  should "provide Cell.cell_name" do
@@ -133,7 +133,7 @@ class RailsRenderTest < ActiveSupport::TestCase
133
133
  render_cell(:bad_guitarist, :groove)
134
134
  end
135
135
 
136
- assert_includes e.message, "Missing template cell/rails/groove with {:handlers=>[:erb, :rjs, :builder, :rhtml, :rxml, :haml], :formats=>[:html, :text, :js, :css, :ics, :csv, :xml, :rss, :atom, :yaml, :multipart_form, :url_encoded_form, :json], :locale=>[:en, :en]} in view paths"
136
+ assert_includes e.message, "Missing template bassist/groove with {:handlers=>[:erb, :rjs, :builder, :rhtml, :rxml, :haml], :formats=>[:html, :text, :js, :css, :ics, :csv, :xml, :rss, :atom, :yaml, :multipart_form, :url_encoded_form, :json], :locale=>[:en, :en]} in view paths"
137
137
  else # >= 3.1
138
138
  e = assert_raise ActionView::MissingTemplate do
139
139
  render_cell(:bad_guitarist, :groove)
@@ -53,7 +53,11 @@ class TestCaseTest < Cell::TestCase
53
53
  context "#view_assigns" do
54
54
  should "be emtpy when nothing was set" do
55
55
  render_cell(:bassist, :play)
56
- assert_equal({}, view_assigns)
56
+ if Cells.rails3_0?
57
+ assert_equal([:lookup_context], view_assigns.keys)
58
+ else
59
+ assert_equal({}, view_assigns)
60
+ end
57
61
  end
58
62
 
59
63
  should "return the instance variables from the last #render_cell" do
@@ -63,7 +67,12 @@ class TestCaseTest < Cell::TestCase
63
67
  end
64
68
  end
65
69
  render_cell(:bassist, :sleep)
66
- assert_equal({:duration => "8h"}, view_assigns)
70
+ if Cells.rails3_0?
71
+ assert_equal([:lookup_context, :duration], view_assigns.keys)
72
+ assert_equal("8h", view_assigns[:duration])
73
+ else
74
+ assert_equal({:duration => "8h"}, view_assigns)
75
+ end
67
76
  end
68
77
  end
69
78
 
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 3
7
7
  - 8
8
- - 1
9
- version: 3.8.1
8
+ - 2
9
+ version: 3.8.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - Nick Sutterer
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2012-02-07 00:00:00 +01:00
17
+ date: 2012-02-08 00:00:00 +01:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency