#動機
Railsを用いてテストコードを作成中に以下のコマンドを打つと正常に動作しなくなったので備忘録としてどのように解決したかを記述
$ rails g rspec:request article
Running via Spring preloader in process 15349
Deprecation warning: Expected boolean default value for '--orm'; got :active_record (string).
This will be rejected in the future unless you explicitly pass the options `check_default_type: false` or call `allow_incompatible_default_type!` in your code
You can silence deprecations warning by setting the environment variable THOR_SILENCE_DEPRECATION.
Could not find generator 'rspec:request'. Maybe you meant "rspec:decorator"?
Run `rails generate --help` for more options.
#springとは?
ザックリですが
「開発をよりスピードアップさせるため開発しているアプリケーションをバックグラウンドで保持し、「テスト・rakeタスク・マイグレーション」を毎回起動しなくてもいいようにしてくれるRailsアプリケーションのプリローダー」
といいやつに見えて、ここのプロセスが残っていたりするのが問題の可能性があります。
#解決手順
まずはspringのstatusを確認
$ spring status
Spring is running:
3729 spring server | blogapp | started 17 hours ago
やはり止まっていました。
次にspringの停止を行います。
$ spring stop
Spring stopped.
再度状態確認
$ spring status
Spring is not running.
###再度Railsコマンド実行
$ rails g rspec:request article
Running via Spring preloader in process 15565
create spec/requests/articles_spec.rb
成功しました!
再度コマンド操作を行うとspringも実行されますのでご心配なく
身に覚えの無いエラーが起きた際はspringを疑ってみましょう