tiny_cms 0.2.8 → 0.2.10

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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.8
1
+ 0.2.10
@@ -91,9 +91,12 @@ module TinyCMS
91
91
 
92
92
  # Dynamic routing
93
93
  def add_dynamic_route!
94
- controller, action = dynamic_route.split('#')
94
+ controller, action = dynamic_route.split('#')
95
95
  self.dynamic_route_uuid = @@uuid.generate
96
- new_route = ActionController::Routing::Routes.builder.build(permalink, {:controller => controller, :action => action, :dynamic_route_uuid => dynamic_route_uuid})
96
+ action, params = action.split('?')
97
+ route = {:controller => controller, :action => action, :dynamic_route_uuid => dynamic_route_uuid}
98
+ route.merge! Rack::Utils.parse_query(params) if params
99
+ new_route = ActionController::Routing::Routes.builder.build(path, route)
97
100
  ActionController::Routing::Routes.routes.unshift new_route
98
101
  end
99
102
 
@@ -267,13 +267,18 @@ class PageTest < Test::Unit::TestCase
267
267
 
268
268
  context 'Dynamic routing' do
269
269
  setup do
270
- @page = Factory :page, :dynamic_route => "dummy#index"
270
+ @page = Factory :page, :parent => Factory(:page),:dynamic_route => "dummy#index"
271
271
  end
272
272
 
273
273
  should 'generate route' do
274
274
  assert_routing @page.path, :controller => 'dummy', :action => 'index', :dynamic_route_uuid => @page.dynamic_route_uuid
275
275
  end
276
276
 
277
+ should 'generate route with params' do
278
+ @page = Factory :page, :dynamic_route => "dummy#index?one=1&two=2"
279
+ assert_recognizes({:controller => 'dummy', :action => 'index', :dynamic_route_uuid => @page.dynamic_route_uuid, :one => '1', :two => '2'}, @page.path)
280
+ end
281
+
277
282
  should 'remove route on destroy' do
278
283
  @page.destroy
279
284
  assert_equal 0, ActionController::Routing::Routes.routes.select{ |route| route.segments.inject(""){|str,s| str << s.to_s} == "#{@page.path}/" }.size
@@ -288,6 +293,9 @@ class PageTest < Test::Unit::TestCase
288
293
  assert_routing @page.path, :controller => 'dummy', :action => 'other', :dynamic_route_uuid => @page.dynamic_route_uuid
289
294
  end
290
295
 
296
+ should 'generate route' do
297
+ assert_routing @page.path, :controller => 'dummy', :action => 'other', :dynamic_route_uuid => @page.dynamic_route_uuid
298
+ end
291
299
  should 'should remove previous route' do
292
300
  assert_equal 1, ActionController::Routing::Routes.routes.select{ |route| route.segments.inject(""){|str,s| str << s.to_s} == "#{@page.path}/" }.size
293
301
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tiny_cms
3
3
  version: !ruby/object:Gem::Version
4
- hash: 7
4
+ hash: 3
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 8
10
- version: 0.2.8
9
+ - 10
10
+ version: 0.2.10
11
11
  platform: ruby
12
12
  authors:
13
13
  - Macario
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-10-27 00:00:00 -05:00
18
+ date: 2010-11-03 00:00:00 -06:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency