'Minitest::UnexpectedError: ActiveRecord::RecordNotFound - all models using find(params[:id]

I had my tests working (for the most part) and now all of the sudden they are all breaking. All models fail with almost all tests - it seems to be fixture related:

  test_should_show_project                                       ERROR (3.19s)
Minitest::UnexpectedError:         ActiveRecord::RecordNotFound: Couldn't find Project with 'id'=980190962 [WHERE "projects"."account_id" = $1]
            app/controllers/projects_controller.rb:120:in `set_project'
            lib/jumpstart/lib/jumpstart/account_middleware.rb:32:in `call'
            test/controllers/projects_controller_test.rb:50:in `block in <class:ProjectsControllerTest>'

set_project is your standard:

  def set_project
    @project = Project.find(params[:id])

    # Uncomment to authorize with Pundit
    authorize @project
  end

For context I am running Searchkick and acts_as_tenant (hence the account_id reference). The set_model is failing in all tests across my app. Restarted the db and ES. I even fired up the console in test mode and all the proper data is in there (even Project with id = 980190962).

As I mentioned this was working - unfortunately I can't really see at which point I broke this.

Anything obvious jump out to anyone?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source