I'm creating a user authentication system for my site. I want to add a default user, so that if I create a new site, or reset the database I will still be able to log in (and change the default user details).
I have the code below in the migration. All seems to be working fine for the development database, but when it come to testing the default user I'm adding is removed and the data from the fixture is loaded instead. Is there any way to add unit testing for this?
class CreateUsers < ActiveRecord::Migration
def self.up
create_table :users do |t|
t.string :name
t.string :hashed_password
t.string :salt
t.timestamps
end
User.add_user("mike", "password")
end
def self.down
drop_table :users
end
end