Hi all, I hope someone can help with what is probably a simple newb installation mistake on my part. I''m having a couple of problems with the salted hash login generator. I installed it following the quickstart guide, and the unit tests work like a charm. There are two errors and a failure on the function tests, though; the verified field seems to be involved in at least one of them. I tried removing the /tmp/ruby* session files in case that was the problem, but no luck. The test results are pasted below the database scheme and list of gems. I''m running OSX 10.3.9, Webrick. If someone can help, please please do. It''s driving me nuts. Thanks, Rob -- -- Table structure for table `users` -- CREATE TABLE `users` ( `id` int(10) unsigned NOT NULL auto_increment, `login` varchar(80) NOT NULL default '''', `salted_password` varchar(40) NOT NULL default '''', `email` varchar(60) NOT NULL default '''', `firstname` varchar(40) default NULL, `lastname` varchar(40) default NULL, `salt` varchar(40) NOT NULL default '''', `verified` int(11) default ''0'', `role` varchar(40) default NULL, `security_token` varchar(40) default NULL, `token_expiry` datetime default NULL, `created_at` datetime default ''0000-00-00 00:00:00'', `updated_at` datetime default ''0000-00-00 00:00:00'', `logged_in_at` datetime default ''0000-00-00 00:00:00'', `deleted` int(11) default ''0'', `delete_after` datetime default NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; *** LOCAL GEMS *** actionmailer (0.9.1) actionpack (1.8.1) actionwebservice (0.7.1) activerecord (1.10.1) activesupport (1.0.4) localization_generator (1.0.7) login_generator (1.1.0) rails (0.12.1) rake (0.5.4) RedCloth (3.0.3) salted_login_generator (1.0.9) sources (0.0.1) ruby -Ilib:test "/usr/local/lib/ruby/gems/1.8/gems/rake-0.5.4/lib/rake/ rake_test_loader.rb" "test/functional/user_controller_test.rb" "test/functional/admin/summary_controller_test.rb" ./test/functional/admin/../../../config/environment.rb:1: warning: already initialized constant RAILS_ROOT ./test/functional/admin/../../../config/environment.rb:2: warning: already initialized constant RAILS_ENV ./test/functional/admin/../../../config/environment.rb:6: warning: already initialized constant ADDITIONAL_LOAD_PATHS ./test/functional/admin/../../../config/environment.rb:52: warning: already initialized constant RAILS_DEFAULT_LOGGER ./test/functional/admin/../../../config/environment.rb:66: warning: already initialized constant Controllers Loaded suite /usr/local/lib/ruby/gems/1.8/gems/rake-0.5.4/lib/rake/rake_test_loader Started ....E.E..F Finished in 10.11708 seconds. 1) Error: test_delete(UserControllerTest): NoMethodError: undefined method `deleted='' for nil:NilClass ./test/functional/../../config/..//app/controllers/user_controller.rb: 141:in `restore_deleted'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.8.1/lib/ action_controller/base.rb:708:in `send'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.8.1/lib/ action_controller/base.rb:708:in `perform_action_without_filters'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.8.1/lib/ action_controller/filters.rb:294:in `perform_action_without_benchmark'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.8.1/lib/ action_controller/benchmarking.rb:37:in `perform_action_without_rescue'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.8.1/lib/ action_controller/benchmarking.rb:37:in `measure'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.8.1/lib/ action_controller/benchmarking.rb:37:in `perform_action_without_rescue'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.8.1/lib/ action_controller/rescue.rb:79:in `perform_action'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.8.1/lib/ action_controller/base.rb:330:in `send'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.8.1/lib/ action_controller/base.rb:330:in `process'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.8.1/lib/ action_controller/test_process.rb:255:in `process'' (eval):3:in `post'' ./test/functional/user_controller_test.rb:128:in `test_delete'' 2) Error: test_forgot_password(UserControllerTest): ActionView::TemplateError: undefined method `errors'' for nil:NilClass On line #2 of /user/change_password.rhtml 1: <div title="<%= title_helper %>" class="form"> 2: <%= head_helper :error => true %> 3: 4: <div class="form-padding"> 5: <%= message_helper ''change'' %> /gems/actionpack-1.8.1/lib/action_view/helpers/active_record_helper.rb: 100:in `error_messages_for'' ./test/functional/../../config/..//app/helpers/user_helper.rb:81:in `head_helper'' (erb):2:in `evaluate_locals'' /gems/actionpack-1.8.1/lib/action_view/base.rb:265:in `evaluate_locals'' /gems/actionpack-1.8.1/lib/action_view/base.rb:276:in `rhtml_render'' /gems/actionpack-1.8.1/lib/action_view/base.rb:201:in `send'' /gems/actionpack-1.8.1/lib/action_view/base.rb:201:in `render_template'' /gems/actionpack-1.8.1/lib/action_view/base.rb:181:in `render_file'' /gems/actionpack-1.8.1/lib/action_controller/layout.rb:208:in `render_without_benchmark'' /gems/actionpack-1.8.1/lib/action_controller/benchmarking.rb:23:in `render'' /gems/actionpack-1.8.1/lib/action_controller/benchmarking.rb:23:in `measure'' /gems/actionpack-1.8.1/lib/action_controller/benchmarking.rb:23:in `render'' /gems/actionpack-1.8.1/lib/action_controller/base.rb:709:in `perform_action_without_filters'' /gems/actionpack-1.8.1/lib/action_controller/filters.rb:294:in `perform_action_without_benchmark'' /gems/actionpack-1.8.1/lib/action_controller/benchmarking.rb:37:in `perform_action_without_rescue'' /gems/actionpack-1.8.1/lib/action_controller/benchmarking.rb:37:in `measure'' /gems/actionpack-1.8.1/lib/action_controller/benchmarking.rb:37:in `perform_action_without_rescue'' /gems/actionpack-1.8.1/lib/action_controller/rescue.rb:79:in `perform_action'' /gems/actionpack-1.8.1/lib/action_controller/base.rb:330:in `send'' /gems/actionpack-1.8.1/lib/action_controller/base.rb:330:in `process'' /gems/actionpack-1.8.1/lib/action_controller/test_process.rb:255:in `process'' (eval):3:in `post'' ./test/functional/user_controller_test.rb:220:in `do_forgot_password'' ./test/functional/user_controller_test.rb:262:in `test_forgot_password'' /usr/local/lib/ruby/1.8/test/unit/testcase.rb:70:in `__send__'' /usr/local/lib/ruby/1.8/test/unit/testcase.rb:70:in `run'' /usr/local/lib/ruby/1.8/test/unit/testsuite.rb:32:in `run'' /usr/local/lib/ruby/1.8/test/unit/testsuite.rb:31:in `each'' /usr/local/lib/ruby/1.8/test/unit/testsuite.rb:31:in `run'' /usr/local/lib/ruby/1.8/test/unit/testsuite.rb:32:in `run'' /usr/local/lib/ruby/1.8/test/unit/testsuite.rb:31:in `each'' /usr/local/lib/ruby/1.8/test/unit/testsuite.rb:31:in `run'' /usr/local/lib/ruby/1.8/test/unit/ui/testrunnermediator.rb:44:in `run_suite'' /usr/local/lib/ruby/1.8/test/unit/ui/console/testrunner.rb:65:in `start_mediator'' /usr/local/lib/ruby/1.8/test/unit/ui/console/testrunner.rb:39:in `start'' /usr/local/lib/ruby/1.8/test/unit/ui/testrunnerutilities.rb:27:in `run'' /usr/local/lib/ruby/1.8/test/unit/autorunner.rb:194:in `run'' /usr/local/lib/ruby/1.8/test/unit/autorunner.rb:14:in `run'' /usr/local/lib/ruby/1.8/test/unit.rb:285 /usr/local/lib/ruby/1.8/test/unit.rb:283 3) Failure: test_signup(UserControllerTest) [./test/functional/user_controller_test.rb:65:in `do_test_signup'' ./test/functional/user_controller_test.rb:145:in `test_signup'']: <1> expected but was <0>. 10 tests, 77 assertions, 1 failures, 2 errors rake aborted! Command failed with status (1): [ruby -Ilib:test "/usr/local/lib/ruby/gems/...]
François Beausoleil
2005-Jul-05 12:39 UTC
Re: Salted hash login generator (verification problem?)
Hello Robert, Robert Wheaton said the following on 2005-07-05 03:46:> [...] I''m having a couple of problems with > the salted hash login generator. [...] > > If someone can help, please please do. It''s driving me nuts.I have had the same kind of problem. Two things to do: 1. If you are using MySQL, make sure to use an InnoDB table for your account/user table. The tests depend on rollback behaviour. This should be an environmental test[1]; 2. I had to add a reset_session call to the signup method, right before redirecting to login. Else, the session contained a partially initialized account, and the verified field never got changed. Hope that helps ! François
Robert Wheaton
2005-Jul-05 22:13 UTC
Re: Salted hash login generator (verification problem?)
Thanks, François Unfortunately that didn''t work -- I''m still getting the same errors. I''m assuming that the Inno table is set up correctly; a dump of the table is as follows: CREATE TABLE `users` ( `id` int(10) unsigned NOT NULL auto_increment, `login` varchar(80) NOT NULL default '''', `salted_password` varchar(40) NOT NULL default '''', `email` varchar(60) NOT NULL default '''', `firstname` varchar(40) default NULL, `lastname` varchar(40) default NULL, `salt` varchar(40) NOT NULL default '''', `verified` int(11) default ''0'', `role` varchar(40) default NULL, `security_token` varchar(40) default NULL, `token_expiry` datetime default NULL, `created_at` datetime default ''0000-00-00 00:00:00'', `updated_at` datetime default ''0000-00-00 00:00:00'', `logged_in_at` datetime default ''0000-00-00 00:00:00'', `deleted` int(11) default ''0'', `delete_after` datetime default NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; Is there anything else I need to do test or setup this table? Thanks if you -- or anybody -- can help. Rob On 5-Jul-05, at 8:39 AM, François Beausoleil wrote:> I have had the same kind of problem. Two things to do: > 1. If you are using MySQL, make sure to use an InnoDB table for your > account/user table. The tests depend on rollback behaviour. This > should be an environmental test[1]; > > 2. I had to add a reset_session call to the signup method, right > before redirecting to login. Else, the session contained a partially > initialized account, and the verified field never got changed.