In the process of migrating an app from Rails 4.2 to 5. Getting this when trying to run tests:
NameError: uninitialized constant ActiveRecord::FixtureSet::RenderContext::User
test/fixtures/users.yml:6:in `get_binding'
users.yml:
one:
name: "Tim Smith"
email: tim@smith.com
password_digest: <%= User.digest('password') %>
id: 1
It's failing on the User.digest call, which is a method in the User model. This worked in 4.2, but in 5 it can't find that method anymore. Any advice? Is there something more I need to declare in test_helper.rb? Here is what's there now:
ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
require 'application_helper'
class ActiveSupport::TestCase
# Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
fixtures :all
include ApplicationHelper
Aucun commentaire:
Enregistrer un commentaire