cells 4.0.0 → 4.0.1

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: 22c7de3a30ac46478e9d4f4ef37c4b8fe1b49b17
4
- data.tar.gz: 00b8a25633e2495ff4368ffe53e0c8f404ba7d8d
3
+ metadata.gz: 10248a40af9eca0d333368d6df675d88f77be026
4
+ data.tar.gz: b4fb151ae10270795f57f5a418d3e552424a2631
5
5
  SHA512:
6
- metadata.gz: 991d17fcb0eae9e9261a6f978651601eb2e99053ac95dc5a3621054ccfaf6ebb0003fb628b8d6a974bc6f8af668ba82a9d7de2f66c80f33454f070301bf87efc
7
- data.tar.gz: 9cc7f11fe2703b49721d3a222637d48f13ace7323d7399e876e04e3c43b688fff1419de2c586b01cc342addcedb16f638325590efd76378578114f3e56704ae9
6
+ metadata.gz: bc18a9d14431f421008e3b758d2ac9e567c09cde38330fb0be8264c33682f98e3d32b38f96d1efce0111ff0b3981e60e8262d02ade5d0c5ac83573b6fe675dbc
7
+ data.tar.gz: 3ba936fe9fa477efdf3504c6d2682f8251479b9cacf894bff4b5b95bac5025cc39c67bbc2fd005bf32febd6d519a833d366d299387336db9b281f996ae5cab8a
data/CHANGES.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 4.0.1
2
+
3
+ * Support forgery protection in `form_tag`.
4
+
1
5
  ## 4.0.0
2
6
 
3
7
  * **Rails Support:** Rails 4.0+ is fully supported, in older versions some form helpers do not work. Let us know how you fixed this.
data/README.md CHANGED
@@ -46,7 +46,7 @@ Usually, you'd pass in one or more objects you want the cell to present. That ca
46
46
  A cell is a light-weight class with one or multiple methods that render views.
47
47
 
48
48
  ```ruby
49
- class Comment::Cell < Cell::ViewModel
49
+ class CommentCell < Cell::ViewModel
50
50
  property :body
51
51
  property :author
52
52
 
@@ -2,9 +2,9 @@ module Cell
2
2
  module Caching
3
3
  module Notifications
4
4
  def fetch_from_cache_for(key, options)
5
- ActiveSupport::Notifications.instrument('read_fragment.cells', :key => key) do
5
+ ActiveSupport::Notifications.instrument('read_fragment.cells', key: key) do
6
6
  cache_store.fetch(key, options) do
7
- ActiveSupport::Notifications.instrument('write_fragment.cells', :key => key) do
7
+ ActiveSupport::Notifications.instrument('write_fragment.cells', key: key) do
8
8
  yield
9
9
  end
10
10
  end
@@ -12,6 +12,6 @@ module Cell::ViewModel::Partial
12
12
  view += ".#{options[:formats].first}" if options[:formats]
13
13
  prefixes = self.class.view_paths.collect { |path| parts.unshift(path).join("/") }
14
14
 
15
- options.merge!(:view => view, :prefixes => prefixes)
15
+ options.merge!(view: view, prefixes: prefixes)
16
16
  end
17
17
  end
@@ -15,7 +15,7 @@ module Cell
15
15
  # Returns the cell instance for +name+. You may pass arbitrary options to your
16
16
  # cell.
17
17
  #
18
- # = cell(:song, :title => "Creeping Out Sara").render(:show)
18
+ # = cell(:song, title: "Creeping Out Sara").render(:show)
19
19
  def cell(name, *args, &block)
20
20
  controller.cell(name, *args, &block)
21
21
  end
@@ -39,10 +39,8 @@ module Cell
39
39
  included do
40
40
  extend Uber::Delegates
41
41
  delegates :parent_controller, :session, :params, :request, :config, :env, :url_options
42
- end
43
-
44
- def protect_against_forgery? # TODO: implement forgery protection with ActionController.
45
- false
42
+ # forgery protection.
43
+ delegates :parent_controller, :protect_against_forgery?, :form_authenticity_token, :request_forgery_protection_token
46
44
  end
47
45
 
48
46
  def call(*)
@@ -1,3 +1,3 @@
1
1
  module Cell
2
- VERSION = "4.0.0"
2
+ VERSION = "4.0.1"
3
3
  end
@@ -129,7 +129,7 @@ module Cell
129
129
  def with_layout(options, content)
130
130
  return content unless layout = options[:layout]
131
131
 
132
- template = find_template(options.merge :view => layout) # we could also allow a different layout engine, etc.
132
+ template = find_template(options.merge view: layout) # we could also allow a different layout engine, etc.
133
133
 
134
134
  render_template(template, options) { content }
135
135
  end
@@ -200,9 +200,9 @@ module Cell
200
200
  def normalize_options(options, caller) # TODO: rename to #setup_options! to be inline with Trb.
201
201
  options = if options.is_a?(Hash)
202
202
  # TODO: speedup by not doing state_for_implicit_render.
203
- {:view => state_for_implicit_render(caller)}.merge(options)
203
+ {view: state_for_implicit_render(caller)}.merge(options)
204
204
  else
205
- {:view => options.to_s}
205
+ {view: options.to_s}
206
206
  end
207
207
 
208
208
  options[:prefixes] ||= _prefixes
@@ -45,7 +45,7 @@ class BuilderTest < MiniTest::Spec
45
45
  it do
46
46
  cell = SongCell.(Song.new("San Francisco"), evergreen: true)
47
47
  cell.must_be_instance_of EvergreenCell
48
- cell.options.must_equal({:evergreen=>true})
48
+ cell.options.must_equal({evergreen:true})
49
49
  end
50
50
 
51
51
  # without arguments.
@@ -104,10 +104,10 @@ class CachingUnitTest < MiniTest::Spec
104
104
  # end
105
105
 
106
106
  # it "accept cache options" do
107
- # key = @class.state_cache_key(:tock, :volume => 9)
107
+ # key = @class.state_cache_key(:tock, volume: 9)
108
108
  # assert Cell::Rails.cache_store.write(key, 'ONE!')
109
109
 
110
- # MusicianController.new.expire_cell_state(DirectorCell, :tock, :volume => 9)
110
+ # MusicianController.new.expire_cell_state(DirectorCell, :tock, volume: 9)
111
111
  # assert_equal "1", @class.cache_store.read(@key)
112
112
  # assert_not ::Cell::Rails.cache_store.read(key)
113
113
  # end
@@ -183,7 +183,7 @@ class CachingTest < MiniTest::Spec
183
183
  # compute key with cell properties from #initialize.
184
184
  it do
185
185
  director_cell.class.cache :show do
186
- @counter < 3 ? {:count => "<"} : {:count => ">"}
186
+ @counter < 3 ? {count: "<"} : {count: ">"}
187
187
  end
188
188
 
189
189
  director_cell(1).call.must_equal "1"
@@ -197,7 +197,7 @@ class CachingTest < MiniTest::Spec
197
197
  director_cell.class.cache :show, :version
198
198
  director_cell.class.class_eval do
199
199
  def version
200
- @counter < 3 ? {:count => "<"} : {:count => ">"}
200
+ @counter < 3 ? {count: "<"} : {count: ">"}
201
201
  end
202
202
  end
203
203
 
@@ -261,7 +261,7 @@ class CachingTest < MiniTest::Spec
261
261
 
262
262
  # options are passed through to cache store.
263
263
  # :expires_in.
264
- # :tags => lambda { |one, two, three| "#{one},#{two},#{three}" }
264
+ # tags: lambda { |one, two, three| "#{one},#{two},#{three}" }
265
265
  class CacheStore
266
266
  attr_reader :fetch_args
267
267
 
@@ -288,7 +288,7 @@ end
288
288
 
289
289
  class CachingInheritanceTest < CachingTest
290
290
  class DirectorCell < ::DirectorCell
291
- cache :show, :expires_in => 10.minutes do
291
+ cache :show, expires_in: 10.minutes do
292
292
  "v1"
293
293
  end
294
294
  end
@@ -297,7 +297,7 @@ class CachingInheritanceTest < CachingTest
297
297
  end
298
298
 
299
299
  class DirectorsDaughterCell < ::DirectorCell
300
- cache :show, :expires_in => 9.minutes do
300
+ cache :show, expires_in: 9.minutes do
301
301
  "v2"
302
302
  end
303
303
  end
@@ -16,7 +16,7 @@ module Record
16
16
  # cell(:song, concept: :record)
17
17
  class Song < self # cell("record/cell/song")
18
18
  def show
19
- render :view => :song#, :layout => "layout"
19
+ render view: :song#, layout: "layout"
20
20
  # TODO: test layout: .. in ViewModel
21
21
  end
22
22
  end
@@ -20,7 +20,7 @@ class PublicTest < MiniTest::Spec
20
20
  it { Cell::ViewModel.cell("public_test/song").must_be_instance_of SongCell }
21
21
 
22
22
  # ViewModel.cell passes options to cell.
23
- it { Cell::ViewModel.cell("public_test/song", Object, genre: "Metal").initialize_args.must_equal [Object, {:genre=>"Metal"}] }
23
+ it { Cell::ViewModel.cell("public_test/song", Object, genre: "Metal").initialize_args.must_equal [Object, {genre:"Metal"}] }
24
24
 
25
25
  # ViewModel.cell(collection: []) renders cells.
26
26
  it { Cell::ViewModel.cell('public_test/song', collection: [Object, Module]).must_equal '[Object, {}][Module, {}]' }
@@ -95,10 +95,4 @@ class RenderTest < MiniTest::Spec
95
95
  end
96
96
 
97
97
  # test inheritance
98
-
99
- # test view: :bla and :bla
100
- # with layout and locals.
101
- # with layout and :text
102
-
103
- # render with format (e.g. when using ERB for one view)
104
- # should we allow changing the format "per run", so a cell can do .js and .haml? or should that be configurable on class level?
98
+ # with layout and locals.
@@ -22,19 +22,19 @@ end
22
22
 
23
23
  class MusicianController < ActionController::Base
24
24
  def view_with_concept_with_show
25
- render :inline => %{<%= concept("view_extensions_test/cell", "Up For Breakfast", volume: 1).show %>} # TODO: concept doesn't need .call
25
+ render inline: %{<%= concept("view_extensions_test/cell", "Up For Breakfast", volume: 1).show %>} # TODO: concept doesn't need .call
26
26
  end
27
27
 
28
28
  def view_with_concept_without_call
29
- render :inline => %{<%= concept("view_extensions_test/cell", "A Tale That Wasn't Right") %>} # this tests ViewModel#to_s.
29
+ render inline: %{<%= concept("view_extensions_test/cell", "A Tale That Wasn't Right") %>} # this tests ViewModel#to_s.
30
30
  end
31
31
 
32
32
  def view_with_concept_with_call
33
- render :inline => %{<%= concept("view_extensions_test/cell", "A Tale That Wasn't Right").call %>}
33
+ render inline: %{<%= concept("view_extensions_test/cell", "A Tale That Wasn't Right").call %>}
34
34
  end
35
35
 
36
36
  def view_with_cell_with_call
37
- render :inline => %{<%= cell("view_extensions_test/song", "A Tale That Wasn't Right").call %>}
37
+ render inline: %{<%= cell("view_extensions_test/song", "A Tale That Wasn't Right").call %>}
38
38
  end
39
39
 
40
40
  def action_with_concept_with_call
@@ -20,7 +20,7 @@
20
20
  # end
21
21
  # end
22
22
 
23
- # let (:model) { OpenStruct.new(:title => "Kenny") }
23
+ # let (:model) { OpenStruct.new(title: "Kenny") }
24
24
 
25
25
  # it { SongCell.new( model, :online? => true).call.must_equal "kenny is true" }
26
26
  # end
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
4
+ version: 4.0.1
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-06-09 00:00:00.000000000 Z
11
+ date: 2015-06-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: uber