Browse Source

Add factorybot

pull/21/head
baarkerlounger 3 years ago
parent
commit
0c73220831
  1. 1
      Gemfile
  2. 6
      Gemfile.lock
  3. 8
      spec/spec_helper.rb

1
Gemfile

@ -28,6 +28,7 @@ group :development, :test do
gem "pry-byebug" gem "pry-byebug"
gem "dotenv-rails" gem "dotenv-rails"
gem "selenium-webdriver" gem "selenium-webdriver"
gem "factory_bot_rails"
%w[rspec-core rspec-expectations rspec-mocks rspec-rails rspec-support].each do |lib| %w[rspec-core rspec-expectations rspec-mocks rspec-rails rspec-support].each do |lib|
gem lib, git: "https://github.com/rspec/#{lib}.git", branch: "main" gem lib, git: "https://github.com/rspec/#{lib}.git", branch: "main"
end end

6
Gemfile.lock

@ -134,6 +134,11 @@ GEM
dotenv (= 2.7.6) dotenv (= 2.7.6)
railties (>= 3.2) railties (>= 3.2)
erubi (1.10.0) erubi (1.10.0)
factory_bot (6.2.0)
activesupport (>= 5.0.0)
factory_bot_rails (6.2.0)
factory_bot (~> 6.2.0)
railties (>= 5.0.0)
ffi (1.15.4) ffi (1.15.4)
globalid (0.5.2) globalid (0.5.2)
activesupport (>= 5.0) activesupport (>= 5.0)
@ -311,6 +316,7 @@ DEPENDENCIES
byebug byebug
capybara capybara
dotenv-rails dotenv-rails
factory_bot_rails
govuk-components govuk-components
govuk_design_system_formbuilder govuk_design_system_formbuilder
jbuilder (~> 2.7) jbuilder (~> 2.7)

8
spec/spec_helper.rb

@ -13,6 +13,9 @@
# it. # it.
# #
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
require "factory_bot"
RSpec.configure do |config| RSpec.configure do |config|
# rspec-expectations config goes here. You can use an alternate # rspec-expectations config goes here. You can use an alternate
# assertion/expectation library such as wrong or the stdlib/minitest # assertion/expectation library such as wrong or the stdlib/minitest
@ -84,11 +87,14 @@ RSpec.configure do |config|
# # order dependency and want to debug it, you can fix the order by providing # # order dependency and want to debug it, you can fix the order by providing
# # the seed, which is printed after each run. # # the seed, which is printed after each run.
# # --seed 1234 # # --seed 1234
# config.order = :random config.order = :random
# #
# # Seed global randomization in this process using the `--seed` CLI option. # # Seed global randomization in this process using the `--seed` CLI option.
# # Setting this allows you to use `--seed` to deterministically reproduce # # Setting this allows you to use `--seed` to deterministically reproduce
# # test failures related to randomization by passing the same `--seed` value # # test failures related to randomization by passing the same `--seed` value
# # as the one that triggered the failure. # # as the one that triggered the failure.
# Kernel.srand config.seed # Kernel.srand config.seed
config.include FactoryBot::Syntax::Methods
end end

Loading…
Cancel
Save