Use FactoryBot
This commit is contained in:
parent
1c80c5be0a
commit
f5c95f7de6
3 changed files with 14 additions and 0 deletions
3
Gemfile
3
Gemfile
|
@ -48,6 +48,9 @@ gem 'bootsnap', '>= 1.1.0', require: false
|
||||||
gem 'pry-rails', '~> 0.3'
|
gem 'pry-rails', '~> 0.3'
|
||||||
|
|
||||||
group :development, :test do
|
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:
|
# Faker is used to easily generate fake data:
|
||||||
# names, addresses, phone numbers, etc.
|
# names, addresses, phone numbers, etc.
|
||||||
gem 'faker', '~> 1.8'
|
gem 'faker', '~> 1.8'
|
||||||
|
|
|
@ -56,6 +56,11 @@ GEM
|
||||||
docile (1.3.1)
|
docile (1.3.1)
|
||||||
erubi (1.7.1)
|
erubi (1.7.1)
|
||||||
execjs (2.7.0)
|
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)
|
faker (1.9.1)
|
||||||
i18n (>= 0.7)
|
i18n (>= 0.7)
|
||||||
ffi (1.9.25)
|
ffi (1.9.25)
|
||||||
|
@ -209,6 +214,7 @@ PLATFORMS
|
||||||
DEPENDENCIES
|
DEPENDENCIES
|
||||||
bootsnap (>= 1.1.0)
|
bootsnap (>= 1.1.0)
|
||||||
byebug
|
byebug
|
||||||
|
factory_bot_rails (~> 4.10)
|
||||||
faker (~> 1.8)
|
faker (~> 1.8)
|
||||||
listen (>= 3.0.5, < 3.2)
|
listen (>= 3.0.5, < 3.2)
|
||||||
pg (>= 0.18, < 2.0)
|
pg (>= 0.18, < 2.0)
|
||||||
|
|
5
spec/support/factory_bot.rb
Normal file
5
spec/support/factory_bot.rb
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
RSpec.configure do |config|
|
||||||
|
config.include FactoryBot::Syntax::Methods
|
||||||
|
end
|
Reference in a new issue