Skip to content

Commit

Permalink
added factory bot
Browse files Browse the repository at this point in the history
  • Loading branch information
Dujota committed Jun 7, 2021
1 parent 0542a66 commit 5fb76c5
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,5 @@ end
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

gem "rspec-rails", "~> 5.0", :groups => [:development, :test]

gem "factory_bot_rails", "~> 6.2", :groups => [:development, :test]
6 changes: 6 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ GEM
crass (1.0.6)
diff-lcs (1.4.4)
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.1)
globalid (0.4.2)
activesupport (>= 4.2.0)
Expand Down Expand Up @@ -199,6 +204,7 @@ PLATFORMS
DEPENDENCIES
bootsnap (>= 1.4.4)
byebug
factory_bot_rails (~> 6.2)
jbuilder (~> 2.7)
listen (~> 3.3)
puma (~> 5.0)
Expand Down
11 changes: 7 additions & 4 deletions spec/rails_helper.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# This file is copied to spec/ when you run 'rails generate rspec:install'
require 'spec_helper'
ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../config/environment', __dir__)
require "spec_helper"
ENV["RAILS_ENV"] ||= "test"
require File.expand_path("../config/environment", __dir__)
# Prevent database truncation if the environment is production
abort("The Rails environment is running in production mode!") if Rails.env.production?
require 'rspec/rails'
require "rspec/rails"
# Add additional requires below this line. Rails is not loaded until this point!

# Requires supporting ruby files with custom matchers and macros, etc, in
Expand All @@ -31,6 +31,9 @@
exit 1
end
RSpec.configure do |config|
# Factory Bot
config.include FactoryBot::Syntax::Methods

# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
config.fixture_path = "#{::Rails.root}/spec/fixtures"

Expand Down

0 comments on commit 5fb76c5

Please sign in to comment.