diff --git a/Gemfile b/Gemfile index 7be8b4f..ae1530f 100644 --- a/Gemfile +++ b/Gemfile @@ -10,3 +10,5 @@ gem "rake", "~> 13.0" gem "rspec", "~> 3.0" gem "standard", "~> 1.3" + +gem "factory_bot", "~> 6.3" diff --git a/Gemfile.lock b/Gemfile.lock index a825804..c667e53 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -7,12 +7,33 @@ PATH GEM remote: https://rubygems.org/ specs: + activesupport (7.1.1) + base64 + bigdecimal + concurrent-ruby (~> 1.0, >= 1.0.2) + connection_pool (>= 2.2.5) + drb + i18n (>= 1.6, < 2) + minitest (>= 5.1) + mutex_m + tzinfo (~> 2.0) ast (2.4.2) base64 (0.1.1) + bigdecimal (3.1.4) + concurrent-ruby (1.2.2) + connection_pool (2.4.1) diff-lcs (1.5.0) + drb (2.1.1) + ruby2_keywords + factory_bot (6.3.0) + activesupport (>= 5.0.0) + i18n (1.14.1) + concurrent-ruby (~> 1.0) json (2.6.3) language_server-protocol (3.17.0.3) lint_roller (1.1.0) + minitest (5.20.0) + mutex_m (0.1.2) parallel (1.23.0) parser (3.2.2.4) ast (~> 2.4.1) @@ -54,6 +75,7 @@ GEM rubocop (>= 1.7.0, < 2.0) rubocop-ast (>= 0.4.0) ruby-progressbar (1.13.0) + ruby2_keywords (0.0.5) standard (1.31.2) language_server-protocol (~> 3.17.0.2) lint_roller (~> 1.0) @@ -66,12 +88,15 @@ GEM standard-performance (1.2.1) lint_roller (~> 1.1) rubocop-performance (~> 1.19.1) + tzinfo (2.0.6) + concurrent-ruby (~> 1.0) unicode-display_width (2.5.0) PLATFORMS arm64-darwin-22 DEPENDENCIES + factory_bot (~> 6.3) rake (~> 13.0) rex! rspec (~> 3.0) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index c4b5474..405f066 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,6 +1,13 @@ # frozen_string_literal: true require "rex" +require 'factory_bot' +Dir[ + File.join( + File.expand_path("../support", __FILE__), + "**", + "*.rb" + )].sort.each { |f| require f } RSpec.configure do |config| # Enable flags like --only-failures and --next-failure diff --git a/spec/support/factory_bot.rb b/spec/support/factory_bot.rb new file mode 100644 index 0000000..4445689 --- /dev/null +++ b/spec/support/factory_bot.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +require "factory_bot" + +RSpec.configure do |config| + config.include FactoryBot::Syntax::Methods + + config.before(:suite) do + FactoryBot.find_definitions + end +end