質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
WSL(Windows Subsystem for Linux)

WSL (Windows Subsystem for Linux) は、Windows10のOS上でLinux向けのバイナリプログラムを実行可能にする機能です。また、WindowsOSのAPIを用いた仕組みを提供しており、Linux側からWindowsOSへのファイルアクセスもできます。

Ruby

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

Ruby on Rails 6

Ruby on Rails 6は、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

Q&A

解決済

1回答

668閲覧

Rspecの諸ファイルが生成・発見できません.

sasaharukimedes

総合スコア27

WSL(Windows Subsystem for Linux)

WSL (Windows Subsystem for Linux) は、Windows10のOS上でLinux向けのバイナリプログラムを実行可能にする機能です。また、WindowsOSのAPIを用いた仕組みを提供しており、Linux側からWindowsOSへのファイルアクセスもできます。

Ruby

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

Ruby on Rails 6

Ruby on Rails 6は、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

0グッド

0クリップ

投稿2020/07/03 06:38

編集2020/07/05 08:10

前提・実現したいこと

Railsでアプリを作っています. testとしてRspecをインストールはできている?のかもしれませんが, ファイル群が見つかりません. どのようにすれば発見・もしくは生成できますでしょうか?

発生している問題・エラーメッセージ

エラーメッセージ
$rails g rspec:install

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:install'.
Run rails generate --help for more options.

試したこと

ネットで色々調べてみたのですが, イマイチ答えにたどり着けなかったため, 質問させていただきました.

補足情報(FW/ツールのバージョンなど)

Ruby 2.6, Rails 6.0

追加情報

Gemfile

group :development, :test do gem 'byebug', platforms: [:mri, :mingw, :x64_mingw] gem 'sqlite3' gem 'rspec-rails' end group :test do # Adds support for Capybara system testing and selenium driver gem 'capybara', '>= 2.15' gem 'selenium-webdriver' # Easy installation and use of web drivers to run system tests with browsers gem 'webdrivers' gem 'minitest' #この2つをコメントアウトした後, 言われたコマンドを打ち込んだらできたっぽいです. gem 'minitest-reporters' # end

Config

application.rb

equire_relative 'boot' require 'rails/all' # Require the gems listed in Gemfile, including any gems # you've limited to :test, :development, or :production. Bundler.require(*Rails.groups) module Letters class Application < Rails::Application # Initialize configuration defaults for originally generated Rails version. config.load_defaults 6.0 config.generators do |g| g.test_framework :rspec end # Settings in config/environments/* take precedence over those specified here. # Application configuration can go into files in config/initializers # -- all .rb files in that directory are automatically loaded after loading # the framework and any gems in your application. config.time_zone = "Tokyo" end

Gemlock

GEM remote: https://rubygems.org/ specs: actioncable (6.0.3.2) actionpack (= 6.0.3.2) nio4r (~> 2.0) websocket-driver (>= 0.6.1) actionmailbox (6.0.3.2) actionpack (= 6.0.3.2) activejob (= 6.0.3.2) activerecord (= 6.0.3.2) activestorage (= 6.0.3.2) activesupport (= 6.0.3.2) mail (>= 2.7.1) actionmailer (6.0.3.2) actionpack (= 6.0.3.2) actionview (= 6.0.3.2) activejob (= 6.0.3.2) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) actionpack (6.0.3.2) actionview (= 6.0.3.2) activesupport (= 6.0.3.2) rack (~> 2.0, >= 2.0.8) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0) actiontext (6.0.3.2) actionpack (= 6.0.3.2) activerecord (= 6.0.3.2) activestorage (= 6.0.3.2) activesupport (= 6.0.3.2) nokogiri (>= 1.8.5) actionview (6.0.3.2) activesupport (= 6.0.3.2) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0) activejob (6.0.3.2) activesupport (= 6.0.3.2) globalid (>= 0.3.6) activemodel (6.0.3.2) activesupport (= 6.0.3.2) activerecord (6.0.3.2) activemodel (= 6.0.3.2) activesupport (= 6.0.3.2) activestorage (6.0.3.2) actionpack (= 6.0.3.2) activejob (= 6.0.3.2) activerecord (= 6.0.3.2) marcel (~> 0.3.1) activesupport (6.0.3.2) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) minitest (~> 5.1) tzinfo (~> 1.1) zeitwerk (~> 2.2, >= 2.2.2) addressable (2.7.0) public_suffix (>= 2.0.2, < 5.0) ansi (1.5.0) autoprefixer-rails (9.8.4) execjs bcrypt (3.1.13) bindex (0.8.1) bootsnap (1.4.6) msgpack (~> 1.0) bootstrap-sass (3.4.1) autoprefixer-rails (>= 5.2.1) sassc (>= 2.0.0) builder (3.2.4) byebug (11.1.3) capybara (3.33.0) addressable mini_mime (>= 0.1.3) nokogiri (~> 1.8) rack (>= 1.6.0) rack-test (>= 0.6.3) regexp_parser (~> 1.5) xpath (~> 3.2) childprocess (3.0.0) concurrent-ruby (1.1.6) crass (1.0.6) devise (4.7.2) bcrypt (~> 3.0) orm_adapter (~> 0.1) railties (>= 4.1.0) responders warden (~> 1.2.3) devise-i18n (1.9.1) devise (>= 4.7.1) diff-lcs (1.4.4) erubi (1.9.0) execjs (2.7.0) ffi (1.13.1) globalid (0.4.2) activesupport (>= 4.2.0) i18n (1.8.3) concurrent-ruby (~> 1.0) jbuilder (2.10.0) activesupport (>= 5.0.0) listen (3.2.1) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) loofah (2.6.0) crass (~> 1.0.2) nokogiri (>= 1.5.9) mail (2.7.1) mini_mime (>= 0.1.1) marcel (0.3.3) mimemagic (~> 0.3.2) method_source (1.0.0) mimemagic (0.3.5) mini_mime (1.0.2) mini_portile2 (2.4.0) minitest (5.14.1) minitest-reporters (1.4.2) ansi builder minitest (>= 5.0) ruby-progressbar msgpack (1.3.3) nio4r (2.5.2) nokogiri (1.10.9) mini_portile2 (~> 2.4.0) orm_adapter (0.5.0) pg (1.2.3) public_suffix (4.0.5) puma (4.3.5) nio4r (~> 2.0) rack (2.2.3) rack-proxy (0.6.5) rack rack-test (1.1.0) rack (>= 1.0, < 3) rails (6.0.3.2) actioncable (= 6.0.3.2) actionmailbox (= 6.0.3.2) actionmailer (= 6.0.3.2) actionpack (= 6.0.3.2) actiontext (= 6.0.3.2) actionview (= 6.0.3.2) activejob (= 6.0.3.2) activemodel (= 6.0.3.2) activerecord (= 6.0.3.2) activestorage (= 6.0.3.2) activesupport (= 6.0.3.2) bundler (>= 1.3.0) railties (= 6.0.3.2) sprockets-rails (>= 2.0.0) rails-controller-testing (1.0.5) actionpack (>= 5.0.1.rc1) actionview (>= 5.0.1.rc1) activesupport (>= 5.0.1.rc1) rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) rails-html-sanitizer (1.3.0) loofah (~> 2.3) railties (6.0.3.2) actionpack (= 6.0.3.2) activesupport (= 6.0.3.2) method_source rake (>= 0.8.7) thor (>= 0.20.3, < 2.0) rake (13.0.1) rb-fsevent (0.10.4) rb-inotify (0.10.1) ffi (~> 1.0) regexp_parser (1.7.1) responders (3.0.1) actionpack (>= 5.0) railties (>= 5.0) rspec-core (3.9.2) rspec-support (~> 3.9.3) rspec-expectations (3.9.2) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.9.0) rspec-mocks (3.9.1) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.9.0) rspec-rails (4.0.1) actionpack (>= 4.2) activesupport (>= 4.2) railties (>= 4.2) rspec-core (~> 3.9) rspec-expectations (~> 3.9) rspec-mocks (~> 3.9) rspec-support (~> 3.9) rspec-support (3.9.3) ruby-progressbar (1.10.1) rubyzip (2.3.0) sass-rails (6.0.0) sassc-rails (~> 2.1, >= 2.1.1) sassc (2.4.0) ffi (~> 1.9) sassc-rails (2.1.2) railties (>= 4.0.0) sassc (>= 2.0) sprockets (> 3.0) sprockets-rails tilt selenium-webdriver (3.142.7) childprocess (>= 0.5, < 4.0) rubyzip (>= 1.2.2) spring (2.1.0) spring-watcher-listen (2.0.1) listen (>= 2.7, < 4.0) spring (>= 1.2, < 3.0) sprockets (4.0.2) concurrent-ruby (~> 1.0) rack (> 1, < 3) sprockets-rails (3.2.1) actionpack (>= 4.0) activesupport (>= 4.0) sprockets (>= 3.0.0) sqlite3 (1.4.2) thor (1.0.1) thread_safe (0.3.6) tilt (2.0.10) turbolinks (5.2.1) turbolinks-source (~> 5.2) turbolinks-source (5.2.0) tzinfo (1.2.7) thread_safe (~> 0.1) warden (1.2.8) rack (>= 2.0.6) web-console (4.0.3) actionview (>= 6.0.0) activemodel (>= 6.0.0) bindex (>= 0.4.0) railties (>= 6.0.0) webdrivers (4.4.1) nokogiri (~> 1.6) rubyzip (>= 1.3.0) selenium-webdriver (>= 3.0, < 4.0) webpacker (4.2.2) activesupport (>= 4.2) rack-proxy (>= 0.6.1) railties (>= 4.2) websocket-driver (0.7.2) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) xpath (3.2.0) nokogiri (~> 1.8) zeitwerk (2.3.1) PLATFORMS ruby DEPENDENCIES bcrypt bootsnap (>= 1.4.2) bootstrap-sass byebug capybara (>= 2.15) devise devise-i18n jbuilder (~> 2.7) listen (~> 3.2) minitest minitest-reporters pg puma (~> 4.1) rails (~> 6.0.3, >= 6.0.3.1) rails-controller-testing rspec-rails sass-rails (>= 6) selenium-webdriver spring spring-watcher-listen (~> 2.0.0) sqlite3 turbolinks (~> 5) tzinfo-data web-console (>= 3.3.0) webdrivers webpacker (~> 4.0) RUBY VERSION ruby 2.6.5p114 BUNDLED WITH 2.1.4

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

maisumakun

2020/07/03 06:42

warningが出ているだけで特に問題なさそうにも見えるのですが、インストールはなされていなかったのでしょうか?
sasaharukimedes

2020/07/03 06:47

@maisumakun あれ?これは警告が出ているだけで, インストールできているのでしょうか?作業しているアプリ内に, rspecのファイル諸々ができてないんですよね. なので, インストールされていないと判断したのですが. どうしたら諸ファイル達が作られるでしょうか?
guest

回答1

0

ベストアンサー

Could not find generator 'rspec:install'.

このエラーから考えるにrspec-railsをGemfileに追加、bundle installを行っていないように思います。

投稿2020/07/04 04:36

asm

総合スコア15147

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

sasaharukimedes

2020/07/04 07:08

@asmさん スイカ情報しておきますが, Gemfileにこんな感じで記述しており, 一応bundle installもしていますが(再度やり直しもしました.), やはり以下のように出ました. 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:install'. Run `rails generate --help` for more options.
sasaharukimedes

2020/07/04 07:27

誤字失礼しました, 追加情報です.
asm

2020/07/04 07:56

$ bundle install --with test development で明示的にrspec-railsをインストールした場合はどうでしょうか?
sasaharukimedes

2020/07/04 08:51

@asmさん bundle install --with test developmentこのコマンドを打ち込んでみたところ, Using rspec-support 3.9.3 Using rspec-core 3.9.2 Using rspec-expectations 3.9.2 Using rspec-mocks 3.9.1 Using rspec-rails 4.0.1 このようなGem郡が入ったと思われます. がしかし, rails generate rspec:installを再度入力しても, 以下のものが出るだけです... 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:install'. Run `rails generate --help` for more options.
asm

2020/07/04 09:38

$ bundle exec rails g rspec:install -etest で、どうでしょうか?
sasaharukimedes

2020/07/04 11:36

@asmさん やってみましたが, 変わらず 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:install'. Run `rails generate --help` for more options. これが出るだけですね...
asm

2020/07/05 00:14

すこし試してみましたが再現しません。 - bundle installとrails g rspec:installが同一フォルダもしくは同一マシンでない可能性 - なにか他のgemが古く問題を起こしている くらいしか後は思いつきません。
sasaharukimedes

2020/07/05 02:38

@asmさん うーん,一体どこで問題が起こっているんだろう. ちなみにですが, Gemfileのdevelopment, test do のところにだけ書き込めば問題ないですよね? 通常のところには書き込む必要ないと思っていますが....
sasaharukimedes

2020/07/05 02:40

@asm さん configでなにかデフォルト設定をいじっている可能性ってありますか??少し気になるところがあったので, 追加しておくので見てアドバイスを頂けると幸いです.
asm

2020/07/05 03:07 編集

> Gemfileのdevelopment, test do のところにだけ そうですね。 $ bundle にて「Using rspec-rails 4.0.1」を確認できているのならrspec-railsは使われているはずです。 試しにRails6環境にて提示されたapplication.rbと同様に書き換えても問題なかったです。 Gemfile.lockの全文を提示できますか?
sasaharukimedes

2020/07/05 05:35

@asmさん うーん何が行けないんだろうか... Gemfile.lock全文を追加してみました.
asm

2020/07/05 07:23

バージョン全部合わせてもrspec:installできることを確認しました。 あと疑えるのはコマンドの実行方法くらいですね。。。
sasaharukimedes

2020/07/05 08:05

@asmさん うーんなんでだろう. minitestと一緒だとだめとかあるのかな..
sasaharukimedes

2020/07/05 08:08

@asmさん!! 試しにと思ってgemfile からminitestとminitest reportersをコメントアウトしてみたらできたっぽいです!! 実行結果を書きますが, これは正常にできているとみて大丈夫でしょうか?? $ bundle exec rails g rspec:install -etest Running via Spring preloader in process 20539 create .rspec create spec create spec/spec_helper.rb create spec/rails_helper.rb
asm

2020/07/05 08:20

できてますよ うーん、minitest一緒にしても自分は大丈夫でしたが・・・なんでしょう。
sasaharukimedes

2020/07/05 08:51

@asmさん うーんなんでなんでしょうか. とりあえず出来てるっぽいなら続けてみます, ありがとうございました. 参考までに, これも入れとくとテスト便利だよっていうgemあったら教えてほしいです.
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問