nhm tanveer hossain khan (hasan)
2008-Jan-28 13:54 UTC
ActionController::TestCase doesn''t come up with details information when my Class has initialization error.
i was wondering why i was getting the following message -
"Unable to determine the controller to test from
ServiceControllerTest. You''ll need to specify it using ''tests
YourController'' in your test case definition"
after trying several times, i found my "ServiceController" had
initialization error as i had included wrong method name. though to
coming up with this conclusion i had to add "puts $!" to
ActionController::TestCase.
def determine_default_controller_class(name)
name.sub(/Test$/, '''').constantize
rescue NameError
puts "Error #{$!}"
raise NonInferrableControllerError.new(name)
end
i think there should have a patch where it clearly mention about the
original error message.
best wishes,
--
----------------------------------------------------
nhm tanveer hossain khan (hasan)
http://hasan.we4tech.com
----------------------------------------------------
mobile: +880 1713 090 511
----------------------------------------------------
"work for fun"
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Core" group.
To post to this group, send email to rubyonrails-core@googlegroups.com
To unsubscribe from this group, send email to
rubyonrails-core-unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---
Michael Koziarski
2008-Jan-30 01:34 UTC
Re: ActionController::TestCase doesn''t come up with details information when my Class has initialization error.
> i was wondering why i was getting the following message - > "Unable to determine the controller to test from > ServiceControllerTest. You''ll need to specify it using ''tests > YourController'' in your test case definition"I''ve changed the error message a little in: http://dev.rubyonrails.org/changeset/8749 Hopefully this makes it a little easier to track down.> > after trying several times, i found my "ServiceController" had > initialization error as i had included wrong method name. though to > coming up with this conclusion i had to add "puts $!" to > ActionController::TestCase. > > def determine_default_controller_class(name) > name.sub(/Test$/, '''').constantize > rescue NameError > puts "Error #{$!}" > raise NonInferrableControllerError.new(name) > end > > i think there should have a patch where it clearly mention about the > original error message. > > best wishes, > -- > ---------------------------------------------------- > nhm tanveer hossain khan (hasan) > http://hasan.we4tech.com > ---------------------------------------------------- > mobile: +880 1713 090 511 > ---------------------------------------------------- > "work for fun" > > >-- Cheers Koz --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
nhm tanveer hossain khan (hasan)
2008-Jan-30 12:10 UTC
Re: ActionController::TestCase doesn''t come up with details information when my Class has initialization error.
hi,
thanks for your latest patch, it is better than before.
anyway, i was thinking isn''t that better if it could have the original
error message.
let''s say -
def determine_default_controller_class(name)
name.sub(/Test$/, '''').constantize
rescue NameError
raise NonInferrableControllerError.new(name, $!) # pretending
their is an update with the constructor with an optional message
field.
end
class NonInferrableControllerError
def initialize(p_name, p_message)
# ....
end
end
best wishes,
On Jan 30, 7:34 am, "Michael Koziarski" <mich...@koziarski.com>
wrote:> > i was wondering why i was getting the following message -
> > "Unable to determine the controller to test from
> > ServiceControllerTest. You''ll need to specify it using
''tests
> > YourController'' in your test case definition"
>
> I''ve changed the error message a little in:
>
> http://dev.rubyonrails.org/changeset/8749
>
> Hopefully this makes it a little easier to track down.
>
>
>
>
>
> > after trying several times, i found my "ServiceController"
had
> > initialization error as i had included wrong method name. though to
> > coming up with this conclusion i had to add "puts $!" to
> > ActionController::TestCase.
>
> > def determine_default_controller_class(name)
> > name.sub(/Test$/, '''').constantize
> > rescue NameError
> > puts "Error #{$!}"
> > raise NonInferrableControllerError.new(name)
> > end
>
> > i think there should have a patch where it clearly mention about the
> > original error message.
>
> > best wishes,
> > --
> > ----------------------------------------------------
> > nhm tanveer hossain khan (hasan)
> >http://hasan.we4tech.com
> > ----------------------------------------------------
> > mobile: +880 1713 090 511
> > ----------------------------------------------------
> > "work for fun"
>
> --
> Cheers
>
> Koz
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Core" group.
To post to this group, send email to rubyonrails-core@googlegroups.com
To unsubscribe from this group, send email to
rubyonrails-core-unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---