Skip to content

Issue with sample code; pending migrations won't go away #6

@jajames30

Description

@jajames30

Hi Aaron,

I am working my way through your book "Everyday Rails Testing with RSpec" published 2024-12-30. I am really enjoying it and am finding it very helpful -- thanks! I have run into a roadblock though.

I downloaded the Rails 7.1 edition source code zip file from https://everydayrails.com/rspecbook/. Chapters 01 and 02 work fine. When I type "rspec" it runs a test. However, chapters 03 through 06 don't work. I didn't try 07 or 08. Here's what happens:

$ rspec


Migrations are pending. To resolve this issue, run:

        bin/rails db:migrate

You have 9 pending migrations:

db/migrate/20240425020637_create_categories.rb
db/migrate/20240425021439_create_recipes.rb
db/migrate/20240425022102_create_active_storage_tables.active_storage.rb
db/migrate/20240425023144_create_users.rb
db/migrate/20240425024927_add_user_to_recipes.rb
db/migrate/20240427192644_create_favorites.rb
db/migrate/20240505193154_create_comments.rb
db/migrate/20240505203455_add_nickname_to_users.rb
db/migrate/20240507015047_add_api_token_to_user.rb

While loading ./spec/models/recipe_spec.rb an `exit` / `raise SystemExit` occurred, RSpec will now quit.
Failure/Error: abort e.to_s.strip

When I run
$ rails db:migrate:status
it says


database: storage/development.sqlite3

 Status   Migration ID    Migration Name
--------------------------------------------------
   up     20240425020637  Create categories
   up     20240425021439  Create recipes
   up     20240425022102  Create active storage tablesactive storage
   up     20240425023144  Create users
   up     20240425024927  Add user to recipes
   up     20240427192644  Create favorites
   up     20240505193154  Create comments
   up     20240505203455  Add nickname to users
   up     20240507015047  Add api token to user


When I run rails db:migrate or rake db:migrate, nothing changes. When I run bin/rails db: migrate, it says -bash: bin/rails: Permission denied

I have googled this extensively and can't find anything that helps.

Any idea how to fix this?

Thanks,
Jennifer
My Office is a Safe Space
Pronouns: she/her
pronounced “Je’-nih-fur Jayms”

Jennifer James
Senior Acquisitions Associate
IU Indianapolis University Library (formerly IUPUI)
Resource Acquisition and Description Team
UL 1115
755 W. Michigan Street
Indianapolis, IN 46202 USA
(ph) 1-317-278-2326; (f) 1-317-274-7133
jajames@iu.edu <- please note that my email address has changed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions