I''m having trouble getting this to work.
The recipe is simple:
def setup
@controll = SomeController.new
request = ActionController::TestRequest.new
@controller.instance_eval { @params = {}, @request = request }
@controller.send(:initialize_current_url)
end
But with Rails 1.2.3 I''m getting this error:
1) Error:
test_x(ApplicationHelperTest):
TypeError: can''t clone NilClass
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/
action_controller/base.rb:1082:in `clone''
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/
action_controller/base.rb:1082:in `initialize_current_url''
application_helper_test.rb:20:in `send''
application_helper_test.rb:20:in `setup_without_fixtures''
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/
lib/active_record/fixtures.rb:576:in `setup''
Any ideas?
Thanks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
kevin cline wrote:> I''m having trouble getting this to work. > > The recipe is simple: > > def setup > @controll = SomeController.new > request = ActionController::TestRequest.new > @controller.instance_eval { @params = {}, @request = request } > @controller.send(:initialize_current_url) > end > > But with Rails 1.2.3 I''m getting this error: > > 1) Error: > test_x(ApplicationHelperTest):your controller instance variable is named: "@controll" but then you are using another variable by the name of "@controller" (which happens to be nil in this case ilan -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Dec 7, 10:38 am, Ilan Berci <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> kevin cline wrote: > > I''m having trouble getting this to work. > > > The recipe is simple: > > > def setup > > @controll = SomeController.new > > request = ActionController::TestRequest.new > > @controller.instance_eval { @params = {}, @request = request } > > @controller.send(:initialize_current_url) > > end > > > But with Rails 1.2.3 I''m getting this error: > > > 1) Error: > > test_x(ApplicationHelperTest): > > your controller instance variable is named: "@controll" but then you are > using another variable by the name of "@controller" (which happens to > be nil in this caseThanks. Unfortunately, that error is only in the post, and not in the code. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Frederick Cheung
2007-Dec-07 17:00 UTC
Re: Rails Recipe 44 -- Write Tests for Your Helpers
On 7 Dec 2007, at 16:11, kevin cline wrote:> > I''m having trouble getting this to work. > > The recipe is simple: > > def setup > @controll = SomeController.new > request = ActionController::TestRequest.new > @controller.instance_eval { @params = {}, @request = request } > @controller.send(:initialize_current_url) > end >This looks out of date - looking at the source it would seem like the name of the magic instance variables are now @_params and @_request (better yet use the accessors) Fred> But with Rails 1.2.3 I''m getting this error: > > 1) Error: > test_x(ApplicationHelperTest): > > TypeError: can''t clone NilClass > C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ > action_controller/base.rb:1082:in `clone'' > C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ > action_controller/base.rb:1082:in `initialize_current_url'' > application_helper_test.rb:20:in `send'' > application_helper_test.rb:20:in `setup_without_fixtures'' > C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/ > lib/active_record/fixtures.rb:576:in `setup'' > > Any ideas? > > Thanks > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---