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

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

新規登録して質問してみよう
ただいま回答率
85.50%
Ruby

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

Ruby on Rails 6

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

RSpec

RSpecはRuby用のBDD(behaviour-driven development)フレームワークです。

Q&A

解決済

1回答

3045閲覧

Rspecで出るエラーがわからない

hiei1

総合スコア52

Ruby

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

Ruby on Rails 6

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

RSpec

RSpecはRuby用のBDD(behaviour-driven development)フレームワークです。

0グッド

0クリップ

投稿2022/05/16 02:26

Rspecを使ってrailsのテストを行っているのですがエラーが起きてしまいました。私はRspec初心者のためこのエラーがなんだかわかりません。教えてくれると幸いです。

error

1An error occurred while loading rails_helper. 2Failure/Error: config.inculde FactoryBot::Syntax::Methods 3 4NoMethodError: 5 undefined method `inculde' for #<RSpec::Core::Configuration:0x00000248e501abc8> 6 Did you mean? include 7# ./spec/rails_helper.rb:24:in `block in <top (required)>' 8# ./spec/rails_helper.rb:16:in `<top (required)>' 9No examples found. 10No examples found. 11inished in 0.00025 seconds (files took 10.87 seconds to load) 120 examples, 0 failures, 1 error occurred outside of examples 13 14Finished in 0.00025 seconds (files took 10.87 seconds to load) 150 examples, 0 failures, 1 error occurred outside of examples 16

rails_healper.rbとspec_healper.rbを書きます。


rails_healper.rb

1require 'spec_helper' 2ENV['RAILS_ENV'] ||= 'test' 3require File.expand_path('../../config/environment', __FILE__) 4abort("The Rails environment is running in production mode!") if Rails.env.production? 5require 'rspec/rails' 6require 'factory_bot' 7require 'faker' 8 Dir[Rails.root.join("spec/support/**/*.rb")].each { |file| require file} 9 begin 10 ActiveRecord::Migration.maintain_test_schema! 11rescue ActiveRecord::PendingMigrationError => e 12 puts e.to_s.strip 13 exit 1 14end 15 RSpec.configure do |config| 16 config.fixture_path = "#{::Rails.root}/spec/fixtures" 17 config.use_transactional_fixtures = true 18 config.infer_spec_type_from_file_location! 19 # Filter lines from Rails gems in backtraces. 20 config.filter_rails_from_backtrace! 21 # arbitrary gems may also be filtered via: 22 # config.filter_gems_from_backtrace("gem name") 23 config.inculde FactoryBot::Syntax::Methods 24end

spec_healper.rb

1RSpec.configure do |config| 2 config.expect_with :rspec do |expectations| 3 expectations.include_chain_clauses_in_custom_matcher_descriptions = true 4 end 5 config.mock_with :rspec do |mocks| 6 mocks.verify_partial_doubles = true 7 end 8 config.shared_context_metadata_behavior = :apply_to_host_groups 9end

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

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

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

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

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

guest

回答1

0

ベストアンサー

undefined method `inculde' for #<RSpec::Core::Configuration:0x00000248e501abc8> Did you mean? include

エラーメッセージのとおりです。includeinculdeになってしまっています。

投稿2022/05/16 02:30

maisumakun

総合スコア145123

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

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

hiei1

2022/05/16 02:38

確認不足でした。すいません。本当にありがとうございました!!!
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

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

ただいまの回答率
85.50%

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

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

質問する

関連した質問