mirror of
https://github.com/Evolix/chexpire.git
synced 2024-05-26 20:28:49 +02:00
Setup factory_bot
This commit is contained in:
parent
dc2c1b88d0
commit
611c8b78b8
5
Gemfile
5
Gemfile
|
@ -47,6 +47,8 @@ group :development, :test do
|
|||
gem 'binding_of_caller'
|
||||
gem 'pry-byebug'
|
||||
gem 'pry-rails'
|
||||
|
||||
gem "factory_bot_rails"
|
||||
end
|
||||
|
||||
group :development do
|
||||
|
@ -61,7 +63,6 @@ group :development do
|
|||
gem 'annotate', require: false
|
||||
gem 'letter_opener_web'
|
||||
|
||||
|
||||
gem "guard"
|
||||
gem "guard-minitest"
|
||||
|
||||
|
@ -78,6 +79,8 @@ group :test do
|
|||
# Easy installation and use of chromedriver to run system tests with Chrome
|
||||
gem 'chromedriver-helper'
|
||||
gem 'launchy'
|
||||
|
||||
gem "database_cleaner"
|
||||
end
|
||||
|
||||
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
|
||||
|
|
|
@ -94,6 +94,7 @@ GEM
|
|||
coderay (1.1.2)
|
||||
concurrent-ruby (1.0.5)
|
||||
crass (1.0.4)
|
||||
database_cleaner (1.7.0)
|
||||
debug_inspector (0.0.3)
|
||||
devise (4.4.3)
|
||||
bcrypt (~> 3.0)
|
||||
|
@ -105,6 +106,11 @@ GEM
|
|||
devise (>= 4.4)
|
||||
erubi (1.7.1)
|
||||
execjs (2.7.0)
|
||||
factory_bot (4.10.0)
|
||||
activesupport (>= 3.0.0)
|
||||
factory_bot_rails (4.10.0)
|
||||
factory_bot (~> 4.10.0)
|
||||
railties (>= 3.0.0)
|
||||
ffi (1.9.23)
|
||||
formatador (0.2.5)
|
||||
globalid (0.4.1)
|
||||
|
@ -310,8 +316,10 @@ DEPENDENCIES
|
|||
capistrano3-puma
|
||||
capybara (>= 2.15, < 4.0)
|
||||
chromedriver-helper
|
||||
database_cleaner
|
||||
devise (~> 4.4)
|
||||
devise-i18n (~> 1.6)
|
||||
factory_bot_rails
|
||||
guard
|
||||
guard-minitest
|
||||
jbuilder (~> 2.5)
|
||||
|
|
|
@ -26,4 +26,5 @@ guard "minitest", spring: "bin/rails test" do
|
|||
watch(%r{^test/.+_test\.rb$})
|
||||
watch(%r{^test/test_helper\.rb$}) { "test" }
|
||||
watch(%r{^test/fixtures/.+\.yml$}) { "test" }
|
||||
watch(%r{^test/factories/.+\.rb$}) { "test" }
|
||||
end
|
||||
|
|
13
lib/tasks/factory_bot.rake
Normal file
13
lib/tasks/factory_bot.rake
Normal file
|
@ -0,0 +1,13 @@
|
|||
namespace :factory_bot do
|
||||
desc "Verify that all FactoryBot factories are valid"
|
||||
task lint: :environment do
|
||||
if Rails.env.test?
|
||||
DatabaseCleaner.cleaning do
|
||||
FactoryBot.lint
|
||||
end
|
||||
else
|
||||
system("bundle exec rake factory_bot:lint RAILS_ENV='test'")
|
||||
fail if $CHILD_STATUS.exitstatus.nonzero?
|
||||
end
|
||||
end
|
||||
end
|
4
test/factories/.rubocop.yml
Normal file
4
test/factories/.rubocop.yml
Normal file
|
@ -0,0 +1,4 @@
|
|||
inherit_from: ../../.rubocop.yml
|
||||
|
||||
Style/BlockDelimiters:
|
||||
EnforcedStyle: line_count_based
|
|
@ -12,6 +12,7 @@ class ActiveSupport::TestCase
|
|||
Warden.test_mode!
|
||||
|
||||
# Add more helper methods to be used by all tests here...
|
||||
include FactoryBot::Syntax::Methods
|
||||
end
|
||||
|
||||
Capybara.register_driver :headless_chrome do |app|
|
||||
|
|
Loading…
Reference in a new issue