It was pointed out that my last post was not complete. Things worked, but as soon as you ran the test cases (admittedly, I don't do that very often) things break.
To solve the problem, I found a great page on the rubyonrails.org wiki here
Follow up:
What I did was change the name of the generated fixture from users.yml to phpbb_users.yml. Now this file contains:
first:
user_id: 1
username: "testusers"
user_password: "TEST"
e user_test.rb unit test, comment out the fixture line and add the following:
def setup
ActiveRecord::Base.establish_connection(:phpbbtest)
Fixtures.create_fixtures(File.dirname(__FILE__) + "/../fixtures", "phpbb_users")
end
add a test database in the database.yml:
phpbbtest:
adapter: mysql
database: phpbb_test
username: root
password:
host: localhost
is does is redirect our unit test to use the test database, and use the fixture we created for this test.
This experience has shown me a weakness in my development and testing, look forward to more posts about how I fix all my test cases for this app.
Recent Comments