# Error when running plugin specs

**URL:** https://meta.discourse.org/t/error-when-running-plugin-specs/274701
**Category:** Development
**Created:** [August 10, 2023, 6:04pm UTC](https://meta.discourse.org/t/error-when-running-plugin-specs/274701 "2023-08-10T18:04:17Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [August 10, 2023, 6:04pm UTC](https://meta.discourse.org/t/error-when-running-plugin-specs/274701/1 "2023-08-10T18:04:17Z")

</div>

I’m getting this on two dev instances when trying to run plugin specs on latest.

(database has been rully migrated in the test environment):

e.g `bin/rake plugin:spec\[discourse-locations]`

```plaintext
An error occurred while loading rails_helper.
Failure/Error: default_scope { where(deleted_at: nil) }

ActiveRecord::StatementInvalid:
  PG::UndefinedTable: ERROR: relation "chat_channels" does not exist
  LINE 9: WHERE a.attrelid = '"chat_channels"'::regclass

< SNIP >

# --- Caused by: ---
# PG::UndefinedTable:
# ERROR: relation "chat_channels" does not exist
# LINE 9: WHERE a.attrelid = '"chat_channels"'::regclass

```

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [August 10, 2023, 6:16pm UTC](https://meta.discourse.org/t/error-when-running-plugin-specs/274701/2 "2023-08-10T18:16:51Z")

</div>

Looking at the test database, the chat migrations appear not to have run.

```plaintext
> psql discourse_test 

# \d

```

Oh …!

I forgot to add the first environment variable to include plugins with this db migration (because chat is still a plugin):

```plaintext
LOAD_PLUGINS=1 RAILS_ENV=test rake db:migrate

```

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [September 9, 2023, 6:17pm UTC](https://meta.discourse.org/t/error-when-running-plugin-specs/274701/3 "2023-09-09T18:17:00Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
