Gioele Barabucci
2013-Jul-30  13:29 UTC
How to test a controller mapped to a non-canonical path?
I have a controller `SuperPower` that is responsible for the paths under 
`/super-power`, and not the canonical `/super_power` (notice the hyphen 
instead of the underscore).
In my `routes.rb` I have
     resources ''super-power'', as :super_power
My `super_power_test.rb` contains
     class SuperPowerControllerTest < ActionController::TestCase
         test "shows all available" do
             get :index
             assert_not_nil assign(:powers)
         end
     end
and the test fails with
     # Running tests:
     [1/1] SuperPowerControllerTest#test_shows_all_available = 0.08 s
      1) Error:
     test_shows_all_available(SuperPowerControllerTest):
       ActionController::RoutingError: No route matches 
{:controller=>"super_power"}
The test fails because it doesn''t use the correct path `/super-power` 
but uses the canonical `/super_power`.
Is there a way to associate the tests of a controller to a certain path? 
Is there a way to make this change for all the tests?
--
Gioele Barabucci <gioele-jeERWPXkMA9eoWH0uzbU5w@public.gmane.org>
-- 
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit
https://groups.google.com/d/msgid/rubyonrails-talk/kt8f3p%24lu1%241%40ger.gmane.org.
For more options, visit https://groups.google.com/groups/opt_out.