Am I method_missing something?
Tue, June 10, 2008This is, of course, not rigorous testing. Nevertheless, I managed to deploy pdxspurs.com without running any tests at all. Now I'm trying to make the tests for that site work. It's more difficult than writing the application in the first place. The most difficult tests are those generated by acts_as_authenticated. I have increased the password strength, so the tests generated, which rely on password 'test', don't work. They all depend on knowing what the encrypted password is, so I have to run my strong passwords through the encryption, find the encrypted password in the database, together with another gnarly-looking hex string called the 'salt', and paste them into the test code, to get the users to authenticate automatically when you run the tests. I'll post here when I work it out.
PS. Best intro to acts_as_authenticated -
robmayhew.com/todo-list-u...ed%e2%80%99/
PPS. Nick Kallen's talk at RailsConf about ActiveRecord depended heavily on RSpec. I didn't follow it that well. He would write a method called User.in_role?(role) which would fail if user was not in the role given. Then he added 'return true' to the method, so in_role? would be true for any role so now the tests passed. But this involves writing code which you know is wrong, which you are going to have to delete - so why write it? I've a ways to go before using RSpec for testing.