Reputation: 203
I added a new attribute to my Booking model through a migration.
class AddPickupTimeEndAndPickupDetailsToBookings < ActiveRecord::Migration
def change
add_column :bookings, :pickup_details, :string
end
end
I am now adding validation code:
class Booking < ActiveRecord::Base
[...]
validates :pickup_details, length: { maximum: 150 }
and suddenly all my Booking model specs are failing with:
Failure/Error: create(:booking)
NoMethodError:
undefined method `pickup_details' for #<Booking:0x0000006d043e28>
Either I messed things up awfully, either I'm missing something obvious...
Upvotes: 2
Views: 1431
Reputation: 7044
Have you run migrations for the test environment?
RAILS_ENV=test rake db:migrate
Upvotes: 12