From 4dae12071a2c2210b0fe919eb6dce65d460a0de4 Mon Sep 17 00:00:00 2001 From: Joenio Costa Date: Mon, 31 Mar 2014 23:46:32 -0300 Subject: [PATCH] Only match numbers for the 'id' param in the embed route --- config/routes.rb | 2 +- test/integration/routing_test.rb | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/config/routes.rb b/config/routes.rb index ed56c2e..2098151 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -32,7 +32,7 @@ ActionController::Routing::Routes.draw do |map| map.connect 'user_themes/*stuff', :controller => 'not_found', :action => 'nothing' # embed controller - map.embed_block 'embed/block/:id', :controller => 'embed', :action => 'index', :id => /.+/ + map.embed_block 'embed/block/:id', :controller => 'embed', :action => 'index', :id => /\d+/ # online documentation map.doc 'doc', :controller => 'doc', :action => 'index' diff --git a/test/integration/routing_test.rb b/test/integration/routing_test.rb index 2117bac..8e9c690 100644 --- a/test/integration/routing_test.rb +++ b/test/integration/routing_test.rb @@ -270,5 +270,8 @@ class RoutingTest < ActionController::IntegrationTest assert_routing('/work/free-software/versions', :controller => 'content_viewer', :action => 'article_versions', :page => [ 'work', 'free-software'] ) end + should 'have route to get HTML code of Blocks to embed' do + assert_routing('/embed/block/12345', :controller => 'embed', :action => 'index', :id => '12345') + end end -- libgit2 0.21.2