Permalink
Browse files

Recognize glob route params as an array

* Closes #65
  • Loading branch information...
1 parent 2e85562 commit 21ce037d1228a5f56deac79c55049e33f8dda5ae @kron4eg kron4eg committed with rmm5t Oct 11, 2009
@@ -65,7 +65,7 @@ def guess_controller!
def stringify_params!
@params.each do |key, value|
- @params[key] = value.to_param
+ @params[key] = value.is_a?(Array) ? value.collect {|v| v.to_param } : value.to_param
end
end
@@ -2,6 +2,23 @@
class RouteToMatcherTest < ActionController::TestCase # :nodoc:
+ context "given a controller with a defined glob url" do
+ setup do
+ @controller = define_controller('Examples').new
+ define_routes do |map|
+ map.connect 'examples/*id', :controller => 'examples',
+ :action => 'example'
+ end
+ end
+
+ should "accept glob route" do
+ assert_accepts route(:get, '/examples/foo/bar').
+ to(:action => 'example', :id => ['foo', 'bar']),
+ @controller
+ end
+
+ end
+
context "given a controller with a defined route" do
setup do
@controller = define_controller('Examples').new

0 comments on commit 21ce037

Please sign in to comment.