1
0

More than 1 year has passed since last update.

rspecテストで実行コマンドを押しても回らない

Posted at

エラー画面

https://gyazo.com/ae90547dac639975630a6f11e989f294
ターミナルがそこで止まって、全く動かない状況。
https://gyazo.com/8d831227cc81304526ad6232a0fad014
パンケーキもずっとloadingしている。

解決手順

まずは、データベースを直すところから始める。

①mysqlに接続する。

mysql接続コマンド
mysql -u root   

②データベースを確認する。

このように、現在のデータベースが確認できる。
https://business.facebook.com/commerce/catalogs/476007677054230/home?business_id=903880390185351

③データベースを削除する。

drop database circusvell_test;

④データーベースを作成する。

 CREATE DATABASE circusvell_test;

⑤再度データベースを確認する。

show databases;

⑥mysqlをexitで抜ける。

パンケーキを確認すると、まっさらなcircusvell_testがあった。
https://gyazo.com/31c5adf5c4a711128d01ce096b10ece8

⑦migrateする。

rails db:migrate RAILS_ENV=test

⑧パンケーキを確認する。

circusvell_testにテーブルとカラムが追加されている。完成。
https://gyazo.com/b518e7fe14155c137443e0e25185aea7

NoDatabaseError

そもそも実行コマンドを押しても動かなくなる前に、NoDatabaseErrorが出てて、色々いじってた。
これエラーがデータベースがないってなってるから作ってあげるだけでなおってたのかもしれない。
https://gyazo.com/f023056a21aed7656ac0e1f933cef61c

参考記事

https://www.dbonline.jp/mysql/database/index5.html
https://prog-8.com/docs/mysql-database-setup
https://qiita.com/waniwaninowani/items/d39a9e4f172b11f62c51

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0