From 91dd071e8e90cea857c30b2707a063bce94e2ae7 Mon Sep 17 00:00:00 2001 From: Alexey Sologub Date: Wed, 14 Sep 2022 09:22:14 -0400 Subject: [PATCH] factory bot gem added --- Gemfile | 1 + Gemfile.lock | 6 ++++++ spec/rails_helper.rb | 2 +- spec/support/factory_bot.rb | 3 +++ 4 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 spec/support/factory_bot.rb diff --git a/Gemfile b/Gemfile index a543804..1e9bbdc 100644 --- a/Gemfile +++ b/Gemfile @@ -29,6 +29,7 @@ group :development, :test do gem 'byebug', platforms: [:mri, :mingw, :x64_mingw] gem 'pry', '~> 0.13.1' gem 'rspec-rails', '~> 4.0.2' + gem 'factory_bot_rails', '~> 6.1.0' end group :development do diff --git a/Gemfile.lock b/Gemfile.lock index 1b03801..a6247cd 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -77,6 +77,11 @@ GEM crass (1.0.6) diff-lcs (1.4.4) erubi (1.10.0) + factory_bot (6.1.0) + activesupport (>= 5.0.0) + factory_bot_rails (6.1.0) + factory_bot (~> 6.1.0) + railties (>= 5.0.0) ffi (1.14.2) globalid (0.4.2) activesupport (>= 4.2.0) @@ -192,6 +197,7 @@ DEPENDENCIES bcrypt bootsnap (>= 1.4.4) byebug + factory_bot_rails (~> 6.1.0) jsonapi.rb jwt listen (~> 3.3) diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index 00345af..283c594 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -20,7 +20,7 @@ # directory. Alternatively, in the individual `*_spec.rb` files, manually # require only the support files necessary. # -# Dir[Rails.root.join('spec', 'support', '**', '*.rb')].sort.each { |f| require f } +Dir[Rails.root.join('spec', 'support', '**', '*.rb')].sort.each { |f| require f } # Checks for pending migrations and applies them before tests are run. # If you are not using ActiveRecord, you can remove these lines. diff --git a/spec/support/factory_bot.rb b/spec/support/factory_bot.rb new file mode 100644 index 0000000..195f20a --- /dev/null +++ b/spec/support/factory_bot.rb @@ -0,0 +1,3 @@ +RSpec.configure do |config| + config.include FactoryBot::Syntax::Methods +end \ No newline at end of file