I’m following chapter 8 of Michale Hartl’s tutorial. When I add:
it { should respond_to(:remember_token) }
to the user_spec.rb file the test fails, with the failure notice pointing directly to this one line in the file.
Prior to adding this line, all tests past.
The only other steps I took after adding this line (and before running the test) was to run a remember token:
$ rails generate migration add_remember_token_to_users
I then updated db/migrate/[timestamp]_add_remember_token_to_users.rb as follows:
class AddRememberTokenToUsers < ActiveRecord::Migration
def change
add_column :users, :remember_token, :string
add_index :users, :remember_token
end
end
and development and test databases as usual:
$ bundle exec rake db:migrate
$ bundle exec rake db:test:prepare
As
Sporkcaches the rails environment it does not know about the migration until it is restarted.Therefore you need to restart the
Sporkserver so that it will reload the rails environment including the new migrations.