From f5c95f7de6c6e1cc166a566e47e72b542ed0480a Mon Sep 17 00:00:00 2001 From: Alex Kotov Date: Fri, 23 Nov 2018 01:26:40 +0500 Subject: [PATCH] Use FactoryBot --- Gemfile | 3 +++ Gemfile.lock | 6 ++++++ spec/support/factory_bot.rb | 5 +++++ 3 files changed, 14 insertions(+) create mode 100644 spec/support/factory_bot.rb diff --git a/Gemfile b/Gemfile index c584797..28b636c 100644 --- a/Gemfile +++ b/Gemfile @@ -48,6 +48,9 @@ gem 'bootsnap', '>= 1.1.0', require: false gem 'pry-rails', '~> 0.3' group :development, :test do + # factory_bot provides a framework and DSL for defining and using factories. + gem 'factory_bot_rails', '~> 4.10' + # Faker is used to easily generate fake data: # names, addresses, phone numbers, etc. gem 'faker', '~> 1.8' diff --git a/Gemfile.lock b/Gemfile.lock index 7638bc0..ca8502c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -56,6 +56,11 @@ GEM docile (1.3.1) erubi (1.7.1) execjs (2.7.0) + factory_bot (4.11.1) + activesupport (>= 3.0.0) + factory_bot_rails (4.11.1) + factory_bot (~> 4.11.1) + railties (>= 3.0.0) faker (1.9.1) i18n (>= 0.7) ffi (1.9.25) @@ -209,6 +214,7 @@ PLATFORMS DEPENDENCIES bootsnap (>= 1.1.0) byebug + factory_bot_rails (~> 4.10) faker (~> 1.8) listen (>= 3.0.5, < 3.2) pg (>= 0.18, < 2.0) diff --git a/spec/support/factory_bot.rb b/spec/support/factory_bot.rb new file mode 100644 index 0000000..2e7665c --- /dev/null +++ b/spec/support/factory_bot.rb @@ -0,0 +1,5 @@ +# frozen_string_literal: true + +RSpec.configure do |config| + config.include FactoryBot::Syntax::Methods +end