Permalink
Browse files

add some tests, yay!

  • Loading branch information...
1 parent 36d9fd7 commit a328f2ffd2d7764c92c87505d0b43f9e3a8c8f28 @tenderlove tenderlove committed Feb 22, 2012
Showing with 31 additions and 0 deletions.
  1. +31 −0 actionpack/test/routing/helper_test.rb
@@ -0,0 +1,31 @@
+require 'abstract_unit'
+
+module ActionDispatch
+ module Routing
+ class HelperTest < ActiveSupport::TestCase
+ class Duck
+ def to_param
+ nil
+ end
+ end
+
+ def test_exception
+ rs = ::ActionDispatch::Routing::RouteSet.new
+ rs.draw do
+ resources :ducks do
+ member do
+ get :pond
+ end
+ end
+ end
+
+ x = Class.new {
+ include rs.url_helpers
+ }
+ assert_raises ActionController::RoutingError do
+ x.new.pond_duck_path Duck.new
+ end
+ end
+ end
+ end
+end

4 comments on commit a328f2f

Member

amatsuda replied Jan 6, 2013

I'm not sure why but I just found that running this test alone fails.

1) Failure:
test_exception(ActionDispatch::Routing::HelperTest) [.../rails/actionpack/test/routing/helper_test.rb:25]:
ActionController::RoutingError expected but nothing was raised.
Member

amatsuda replied Jan 7, 2013

Turned out that this test was not executed via rake test. Including test/routing/**/*_test.rb in Rakefile reveals the error.

diff --git a/actionpack/Rakefile b/actionpack/Rakefile
index ba7956c..7b9a279 100644
--- a/actionpack/Rakefile
+++ b/actionpack/Rakefile
@@ -15,7 +15,7 @@ Rake::TestTask.new(:test_action_pack) do |t|

   # make sure we include the tests in alphabetical order as on some systems
   # this will not happen automatically and the tests (as a whole) will error
-  t.test_files = Dir.glob('test/{abstract,controller,dispatch,template,assertions,journey}/**/*_test.rb').sort
+  t.test_files = Dir.glob('test/{abstract,controller,dispatch,template,assertions,journey,routing}/**/*_test.rb').sort

The test expects x.new.pond_duck_path Duck.new to raise an ActionController::RoutingError but in fact it returns "/ducks//pond"

@tenderlove, which is your intended behaviour?

Owner

pixeltrix replied Jul 17, 2013

@amatsuda fixed here: 74722d6

Member

amatsuda replied Jul 25, 2013

Please sign in to comment.