I have been working with restful_authentication. I have made some changes to it and now I''m trying to get all the default tests that came with the plugin to pass. Here''s one of the tests that error out: def test_should_require_login_on_signup assert_no_difference ''User.count'' do create_user(:login => nil) assert assigns(:user).errors.on(:login) assert_response :success end end This is the error: NoMethodError: You have a nil object when you didn''t expect it! You might have expected an instance of ActiveRecord::Base. The error occurred while evaluating nil.errors When using running debugger and checking in on assigns(:user) it returns nil, so I assume this is the trouble. Finally here''s my question, what is "create_user" doing? Is it creating a new User based upon the users.yml fixture that the test suit is loading, or is it something else? I couldn''t find reference for this "dynamic??" method anywhere. 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 -~----------~----~----~----~------~----~------~--~---
Any thoughts on this? Basically, I just need to know what "create_user" is doing? Is it creating a new User based upon the users.yml fixture that the test suit is loading, or is it something else? I couldn''t find reference for this "dynamic??" method anywhere. def test_should_require_login_on_signup assert_no_difference ''User.count'' do create_user(:login => nil) assert assigns(:user).errors.on(:login) assert_response :success end end On Mar 26, 5:12 pm, elliottg <x...-+PdThUrr9bOXUBVsB0ZYTw@public.gmane.org> wrote:> I have been working with restful_authentication. I have made some > changes to it and now I''m trying to get all the default tests that > came with the plugin to pass. > > Here''s one of the tests that error out: > > def test_should_require_login_on_signup > assert_no_difference ''User.count'' do > create_user(:login => nil) > assert assigns(:user).errors.on(:login) > assert_response :success > end > end > > This is the error: > NoMethodError: You have a nil object when you didn''t expect it! > You might have expected an instance of ActiveRecord::Base. > The error occurred while evaluating nil.errors > > When using running debugger and checking in on assigns(:user) it > returns nil, so I assume this is the trouble. > > Finally here''s my question, what is "create_user" doing? Is it > creating a new User based upon the users.yml fixture that the test > suit is loading, or is it something else? I couldn''t find reference > for this "dynamic??" method anywhere. > > 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
If you look down the end of the file with that code in you will find the definition of create_user. At least in my version anyway. I found it by a global search, but I realised when it found it that I should have looked in that file first. 2009/3/27 elliottg <x@simplecircle.net>> > Any thoughts on this? > > Basically, I just need to know what "create_user" is doing? Is it > creating a new User based upon the users.yml fixture that the test > suit is loading, or is it something else? I couldn''t find reference > for this "dynamic??" method anywhere. > > def test_should_require_login_on_signup > assert_no_difference ''User.count'' do > create_user(:login => nil) > assert assigns(:user).errors.on(:login) > assert_response :success > end > end > > > > On Mar 26, 5:12 pm, elliottg <x...-+PdThUrr9bOXUBVsB0ZYTw@public.gmane.org> wrote: > > I have been working with restful_authentication. I have made some > > changes to it and now I''m trying to get all the default tests that > > came with the plugin to pass. > > > > Here''s one of the tests that error out: > > > > def test_should_require_login_on_signup > > assert_no_difference ''User.count'' do > > create_user(:login => nil) > > assert assigns(:user).errors.on(:login) > > assert_response :success > > end > > end > > > > This is the error: > > NoMethodError: You have a nil object when you didn''t expect it! > > You might have expected an instance of ActiveRecord::Base. > > The error occurred while evaluating nil.errors > > > > When using running debugger and checking in on assigns(:user) it > > returns nil, so I assume this is the trouble. > > > > Finally here''s my question, what is "create_user" doing? Is it > > creating a new User based upon the users.yml fixture that the test > > suit is loading, or is it something else? I couldn''t find reference > > for this "dynamic??" method anywhere. > > > > 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 -~----------~----~----~----~------~----~------~--~---
Doh... I just found it, right after my last post. Thanks for getting back to me. I am assuming that somehow @user is being returned or something? Because, assigns(:user) is being called on the next line?? Is that the case, and further any ideas why its coming up Nil? Testing in script/console test shows that creating a new User works fine and I know the fixture data is in the users table as it should be? Thanks a ton On Mar 27, 1:15 pm, Colin Law <clan...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> If you look down the end of the file with that code in you will find the > definition of create_user. At least in my version anyway. I found it by a > global search, but I realised when it found it that I should have looked in > that file first. > > 2009/3/27 elliottg <x...-+PdThUrr9bOXUBVsB0ZYTw@public.gmane.org> > > > > > Any thoughts on this? > > > Basically, I just need to know what "create_user" is doing? Is it > > creating a new User based upon the users.yml fixture that the test > > suit is loading, or is it something else? I couldn''t find reference > > for this "dynamic??" method anywhere. > > > def test_should_require_login_on_signup > > assert_no_difference ''User.count'' do > > create_user(:login => nil) > > assert assigns(:user).errors.on(:login) > > assert_response :success > > end > > end > > > On Mar 26, 5:12 pm, elliottg <x...-+PdThUrr9bOXUBVsB0ZYTw@public.gmane.org> wrote: > > > I have been working with restful_authentication. I have made some > > > changes to it and now I''m trying to get all the default tests that > > > came with the plugin to pass. > > > > Here''s one of the tests that error out: > > > > def test_should_require_login_on_signup > > > assert_no_difference ''User.count'' do > > > create_user(:login => nil) > > > assert assigns(:user).errors.on(:login) > > > assert_response :success > > > end > > > end > > > > This is the error: > > > NoMethodError: You have a nil object when you didn''t expect it! > > > You might have expected an instance of ActiveRecord::Base. > > > The error occurred while evaluating nil.errors > > > > When using running debugger and checking in on assigns(:user) it > > > returns nil, so I assume this is the trouble. > > > > Finally here''s my question, what is "create_user" doing? Is it > > > creating a new User based upon the users.yml fixture that the test > > > suit is loading, or is it something else? I couldn''t find reference > > > for this "dynamic??" method anywhere. > > > > 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
It looks like I have a "Filter chain halted" error going on that is not allowing the user to be created. Thanks for all the help. On Mar 27, 1:27 pm, elliottg <x...-+PdThUrr9bOXUBVsB0ZYTw@public.gmane.org> wrote:> Doh... I just found it, right after my last post. > > Thanks for getting back to me. > > I am assuming that somehow @user is being returned or something? > Because, assigns(:user) is being called on the next line?? > > Is that the case, and further any ideas why its coming up Nil? Testing > in script/console test shows that creating a new User works fine and I > know the fixture data is in the users table as it should be? > > Thanks a ton > > On Mar 27, 1:15 pm, Colin Law <clan...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: > > > If you look down the end of the file with that code in you will find the > > definition of create_user. At least in my version anyway. I found it by a > > global search, but I realised when it found it that I should have looked in > > that file first. > > > 2009/3/27 elliottg <x...-+PdThUrr9bOXUBVsB0ZYTw@public.gmane.org> > > > > Any thoughts on this? > > > > Basically, I just need to know what "create_user" is doing? Is it > > > creating a new User based upon the users.yml fixture that the test > > > suit is loading, or is it something else? I couldn''t find reference > > > for this "dynamic??" method anywhere. > > > > def test_should_require_login_on_signup > > > assert_no_difference ''User.count'' do > > > create_user(:login => nil) > > > assert assigns(:user).errors.on(:login) > > > assert_response :success > > > end > > > end > > > > On Mar 26, 5:12 pm, elliottg <x...-+PdThUrr9bOXUBVsB0ZYTw@public.gmane.org> wrote: > > > > I have been working with restful_authentication. I have made some > > > > changes to it and now I''m trying to get all the default tests that > > > > came with the plugin to pass. > > > > > Here''s one of the tests that error out: > > > > > def test_should_require_login_on_signup > > > > assert_no_difference ''User.count'' do > > > > create_user(:login => nil) > > > > assert assigns(:user).errors.on(:login) > > > > assert_response :success > > > > end > > > > end > > > > > This is the error: > > > > NoMethodError: You have a nil object when you didn''t expect it! > > > > You might have expected an instance of ActiveRecord::Base. > > > > The error occurred while evaluating nil.errors > > > > > When using running debugger and checking in on assigns(:user) it > > > > returns nil, so I assume this is the trouble. > > > > > Finally here''s my question, what is "create_user" doing? Is it > > > > creating a new User based upon the users.yml fixture that the test > > > > suit is loading, or is it something else? I couldn''t find reference > > > > for this "dynamic??" method anywhere. > > > > > 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I can''t help with this as I have tweaked the create code so it is non-standard. Is there a before_filter in UsersController, if so then it may be failing in there. 2009/3/27 elliottg <x@simplecircle.net>> > It looks like I have a "Filter chain halted" error going on that is > not allowing the user to be created. > > Thanks for all the help. > > On Mar 27, 1:27 pm, elliottg <x...-+PdThUrr9bOXUBVsB0ZYTw@public.gmane.org> wrote: > > Doh... I just found it, right after my last post. > > > > Thanks for getting back to me. > > > > I am assuming that somehow @user is being returned or something? > > Because, assigns(:user) is being called on the next line?? > > > > Is that the case, and further any ideas why its coming up Nil? Testing > > in script/console test shows that creating a new User works fine and I > > know the fixture data is in the users table as it should be? > > > > Thanks a ton > > > > On Mar 27, 1:15 pm, Colin Law <clan...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: > > > > > If you look down the end of the file with that code in you will find > the > > > definition of create_user. At least in my version anyway. I found it > by a > > > global search, but I realised when it found it that I should have > looked in > > > that file first. > > > > > 2009/3/27 elliottg <x...-+PdThUrr9bOXUBVsB0ZYTw@public.gmane.org> > > > > > > Any thoughts on this? > > > > > > Basically, I just need to know what "create_user" is doing? Is it > > > > creating a new User based upon the users.yml fixture that the test > > > > suit is loading, or is it something else? I couldn''t find reference > > > > for this "dynamic??" method anywhere. > > > > > > def test_should_require_login_on_signup > > > > assert_no_difference ''User.count'' do > > > > create_user(:login => nil) > > > > assert assigns(:user).errors.on(:login) > > > > assert_response :success > > > > end > > > > end > > > > > > On Mar 26, 5:12 pm, elliottg <x...-+PdThUrr9bOXUBVsB0ZYTw@public.gmane.org> wrote: > > > > > I have been working with restful_authentication. I have made some > > > > > changes to it and now I''m trying to get all the default tests that > > > > > came with the plugin to pass. > > > > > > > Here''s one of the tests that error out: > > > > > > > def test_should_require_login_on_signup > > > > > assert_no_difference ''User.count'' do > > > > > create_user(:login => nil) > > > > > assert assigns(:user).errors.on(:login) > > > > > assert_response :success > > > > > end > > > > > end > > > > > > > This is the error: > > > > > NoMethodError: You have a nil object when you didn''t expect it! > > > > > You might have expected an instance of ActiveRecord::Base. > > > > > The error occurred while evaluating nil.errors > > > > > > > When using running debugger and checking in on assigns(:user) it > > > > > returns nil, so I assume this is the trouble. > > > > > > > Finally here''s my question, what is "create_user" doing? Is it > > > > > creating a new User based upon the users.yml fixture that the test > > > > > suit is loading, or is it something else? I couldn''t find reference > > > > > for this "dynamic??" method anywhere. > > > > > > > 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 -~----------~----~----~----~------~----~------~--~---
A before_filter redirect in role_reqirement_system#access_denied is halting things before the create action of the user controller could be called. Not really sure how test around this as the redirect is a key part of how r_r works. Any thoughts on getting around situations like this? Thanks On Mar 27, 4:32 pm, Colin Law <clan...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> I can''t help with this as I have tweaked the create code so it is > non-standard. Is there a before_filter in UsersController, if so then it > may be failing in there. > > 2009/3/27 elliottg <x...-+PdThUrr9bOXUBVsB0ZYTw@public.gmane.org> > > > > > It looks like I have a "Filter chain halted" error going on that is > > not allowing the user to be created. > > > Thanks for all the help. > > > On Mar 27, 1:27 pm, elliottg <x...-+PdThUrr9bOXUBVsB0ZYTw@public.gmane.org> wrote: > > > Doh... I just found it, right after my last post. > > > > Thanks for getting back to me. > > > > I am assuming that somehow @user is being returned or something? > > > Because, assigns(:user) is being called on the next line?? > > > > Is that the case, and further any ideas why its coming up Nil? Testing > > > in script/console test shows that creating a new User works fine and I > > > know the fixture data is in the users table as it should be? > > > > Thanks a ton > > > > On Mar 27, 1:15 pm, Colin Law <clan...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: > > > > > If you look down the end of the file with that code in you will find > > the > > > > definition of create_user. At least in my version anyway. I found it > > by a > > > > global search, but I realised when it found it that I should have > > looked in > > > > that file first. > > > > > 2009/3/27 elliottg <x...-+PdThUrr9bOXUBVsB0ZYTw@public.gmane.org> > > > > > > Any thoughts on this? > > > > > > Basically, I just need to know what "create_user" is doing? Is it > > > > > creating a new User based upon the users.yml fixture that the test > > > > > suit is loading, or is it something else? I couldn''t find reference > > > > > for this "dynamic??" method anywhere. > > > > > > def test_should_require_login_on_signup > > > > > assert_no_difference ''User.count'' do > > > > > create_user(:login => nil) > > > > > assert assigns(:user).errors.on(:login) > > > > > assert_response :success > > > > > end > > > > > end > > > > > > On Mar 26, 5:12 pm, elliottg <x...-+PdThUrr9bOXUBVsB0ZYTw@public.gmane.org> wrote: > > > > > > I have been working with restful_authentication. I have made some > > > > > > changes to it and now I''m trying to get all the default tests that > > > > > > came with the plugin to pass. > > > > > > > Here''s one of the tests that error out: > > > > > > > def test_should_require_login_on_signup > > > > > > assert_no_difference ''User.count'' do > > > > > > create_user(:login => nil) > > > > > > assert assigns(:user).errors.on(:login) > > > > > > assert_response :success > > > > > > end > > > > > > end > > > > > > > This is the error: > > > > > > NoMethodError: You have a nil object when you didn''t expect it! > > > > > > You might have expected an instance of ActiveRecord::Base. > > > > > > The error occurred while evaluating nil.errors > > > > > > > When using running debugger and checking in on assigns(:user) it > > > > > > returns nil, so I assume this is the trouble. > > > > > > > Finally here''s my question, what is "create_user" doing? Is it > > > > > > creating a new User based upon the users.yml fixture that the test > > > > > > suit is loading, or is it something else? I couldn''t find reference > > > > > > for this "dynamic??" method anywhere. > > > > > > > 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I don''t know about role_requirement_system I am afraid, so only guesswork follows. If I understand correctly the problem is that the restful authentication tests are failing because the role requirement conditions are not satisfied by the test conditions. Possibly you have to adjust the test fixtures and possibly test code so that the users in the fixtures have appropriate roles to satisfy the tests. 2009/3/29 elliottg <x@simplecircle.net>> > A before_filter redirect in role_reqirement_system#access_denied is > halting things before the create action of the user controller could > be called. Not really sure how test around this as the redirect is a > key part of how r_r works. Any thoughts on getting around situations > like this? > > Thanks > > On Mar 27, 4:32 pm, Colin Law <clan...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: > > I can''t help with this as I have tweaked the create code so it is > > non-standard. Is there a before_filter in UsersController, if so then it > > may be failing in there. > > > > 2009/3/27 elliottg <x...-+PdThUrr9bOXUBVsB0ZYTw@public.gmane.org> > > > > > > > > > It looks like I have a "Filter chain halted" error going on that is > > > not allowing the user to be created. > > > > > Thanks for all the help. > > > > > On Mar 27, 1:27 pm, elliottg <x...-+PdThUrr9bOXUBVsB0ZYTw@public.gmane.org> wrote: > > > > Doh... I just found it, right after my last post. > > > > > > Thanks for getting back to me. > > > > > > I am assuming that somehow @user is being returned or something? > > > > Because, assigns(:user) is being called on the next line?? > > > > > > Is that the case, and further any ideas why its coming up Nil? > Testing > > > > in script/console test shows that creating a new User works fine and > I > > > > know the fixture data is in the users table as it should be? > > > > > > Thanks a ton > > > > > > On Mar 27, 1:15 pm, Colin Law <clan...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: > > > > > > > If you look down the end of the file with that code in you will > find > > > the > > > > > definition of create_user. At least in my version anyway. I found > it > > > by a > > > > > global search, but I realised when it found it that I should have > > > looked in > > > > > that file first. > > > > > > > 2009/3/27 elliottg <x...-+PdThUrr9bOXUBVsB0ZYTw@public.gmane.org> > > > > > > > > Any thoughts on this? > > > > > > > > Basically, I just need to know what "create_user" is doing? Is it > > > > > > creating a new User based upon the users.yml fixture that the > test > > > > > > suit is loading, or is it something else? I couldn''t find > reference > > > > > > for this "dynamic??" method anywhere. > > > > > > > > def test_should_require_login_on_signup > > > > > > assert_no_difference ''User.count'' do > > > > > > create_user(:login => nil) > > > > > > assert assigns(:user).errors.on(:login) > > > > > > assert_response :success > > > > > > end > > > > > > end > > > > > > > > On Mar 26, 5:12 pm, elliottg <x...-+PdThUrr9bOXUBVsB0ZYTw@public.gmane.org> wrote: > > > > > > > I have been working with restful_authentication. I have made > some > > > > > > > changes to it and now I''m trying to get all the default tests > that > > > > > > > came with the plugin to pass. > > > > > > > > > Here''s one of the tests that error out: > > > > > > > > > def test_should_require_login_on_signup > > > > > > > assert_no_difference ''User.count'' do > > > > > > > create_user(:login => nil) > > > > > > > assert assigns(:user).errors.on(:login) > > > > > > > assert_response :success > > > > > > > end > > > > > > > end > > > > > > > > > This is the error: > > > > > > > NoMethodError: You have a nil object when you didn''t expect it! > > > > > > > You might have expected an instance of ActiveRecord::Base. > > > > > > > The error occurred while evaluating nil.errors > > > > > > > > > When using running debugger and checking in on assigns(:user) > it > > > > > > > returns nil, so I assume this is the trouble. > > > > > > > > > Finally here''s my question, what is "create_user" doing? Is it > > > > > > > creating a new User based upon the users.yml fixture that the > test > > > > > > > suit is loading, or is it something else? I couldn''t find > reference > > > > > > > for this "dynamic??" method anywhere. > > > > > > > > > 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 -~----------~----~----~----~------~----~------~--~---