Prepare for factory_bot 6
Closes #1336 * removes all the deprecated methods * removes Ruby 2.3, 2.4 and Rails 4.2 from travis * bundle updates the test gemfiles * Removes some pre-5.0 logic from a test helper * Targets Ruby 2.5 with rubocop and fixes violations We could also remove support for Rails 5.0 and 5.1, which are now EOL, but I don't see a strong reason to do that. We don't seem to have to do anything special to support those versions.
This commit is contained in:
parent
c8b1a2c907
commit
102d7f7606
|
@ -4,7 +4,7 @@ inherit_from:
|
|||
- https://raw.githubusercontent.com/thoughtbot/guides/master/style/ruby/.rubocop.yml
|
||||
|
||||
AllCops:
|
||||
TargetRubyVersion: 2.3
|
||||
TargetRubyVersion: 2.5
|
||||
Exclude:
|
||||
- 'gemfiles/*'
|
||||
- 'tmp/**/*'
|
||||
|
|
10
.travis.yml
10
.travis.yml
|
@ -1,6 +1,4 @@
|
|||
rvm:
|
||||
- 2.3
|
||||
- 2.4
|
||||
- 2.5
|
||||
- 2.6
|
||||
- 2.7
|
||||
|
@ -13,20 +11,12 @@ before_install:
|
|||
install: "bundle install --jobs 8"
|
||||
script: "bundle exec rake"
|
||||
gemfile:
|
||||
- gemfiles/4.2.gemfile
|
||||
- gemfiles/5.0.gemfile
|
||||
- gemfiles/5.1.gemfile
|
||||
- gemfiles/5.2.gemfile
|
||||
- gemfiles/6.0.gemfile
|
||||
- gemfiles/master.gemfile
|
||||
matrix:
|
||||
exclude:
|
||||
- rvm: 2.3
|
||||
gemfile: gemfiles/6.0.gemfile
|
||||
- rvm: 2.4
|
||||
gemfile: gemfiles/6.0.gemfile
|
||||
- rvm: 2.7
|
||||
gemfile: gemfiles/4.2.gemfile
|
||||
fast_finish: true
|
||||
allow_failures:
|
||||
- rvm: ruby-head
|
||||
|
|
|
@ -1,9 +1,3 @@
|
|||
appraise "4.2" do
|
||||
gem "activerecord", "~> 4.2.11"
|
||||
gem "activerecord-jdbcsqlite3-adapter", "~> 1.3.25", platforms: [:jruby]
|
||||
gem "sqlite3", "~> 1.3.6", platforms: [:ruby]
|
||||
end
|
||||
|
||||
appraise "5.0" do
|
||||
gem "activerecord", "~> 5.0.7"
|
||||
gem "activerecord-jdbcsqlite3-adapter", platforms: [:jruby]
|
||||
|
|
72
Gemfile.lock
72
Gemfile.lock
|
@ -2,22 +2,17 @@ PATH
|
|||
remote: .
|
||||
specs:
|
||||
factory_bot (5.2.0)
|
||||
activesupport (>= 4.2.0)
|
||||
activesupport (>= 5.0.0)
|
||||
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
activemodel (6.0.2.1)
|
||||
activesupport (= 6.0.2.1)
|
||||
activerecord (6.0.2.1)
|
||||
activemodel (= 6.0.2.1)
|
||||
activesupport (= 6.0.2.1)
|
||||
activerecord-jdbc-adapter (60.1-java)
|
||||
activerecord (~> 6.0.0)
|
||||
activerecord-jdbcsqlite3-adapter (60.1-java)
|
||||
activerecord-jdbc-adapter (= 60.1)
|
||||
jdbc-sqlite3 (~> 3.8, < 3.30)
|
||||
activesupport (6.0.2.1)
|
||||
activemodel (6.0.2.2)
|
||||
activesupport (= 6.0.2.2)
|
||||
activerecord (6.0.2.2)
|
||||
activemodel (= 6.0.2.2)
|
||||
activesupport (= 6.0.2.2)
|
||||
activesupport (6.0.2.2)
|
||||
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||
i18n (>= 0.7, < 2)
|
||||
minitest (~> 5.1)
|
||||
|
@ -27,18 +22,18 @@ GEM
|
|||
bundler
|
||||
rake
|
||||
thor (>= 0.14.0)
|
||||
aruba (0.14.14)
|
||||
childprocess (>= 0.6.3, < 4.0.0)
|
||||
contracts (~> 0.9)
|
||||
cucumber (>= 1.3.19)
|
||||
aruba (1.0.0)
|
||||
childprocess (~> 3.0)
|
||||
contracts (~> 0.16.0)
|
||||
cucumber (>= 2.4, < 4.0)
|
||||
ffi (~> 1.9)
|
||||
rspec-expectations (>= 2.99)
|
||||
thor (>= 0.19, < 2.0)
|
||||
rspec-expectations (~> 3.4)
|
||||
thor (~> 1.0)
|
||||
ast (2.4.0)
|
||||
backports (3.15.0)
|
||||
backports (3.17.1)
|
||||
builder (3.2.4)
|
||||
childprocess (3.0.0)
|
||||
concurrent-ruby (1.1.5)
|
||||
concurrent-ruby (1.1.6)
|
||||
contracts (0.16.0)
|
||||
cucumber (3.1.2)
|
||||
builder (>= 2.1.2)
|
||||
|
@ -58,32 +53,28 @@ GEM
|
|||
cucumber-wire (0.0.1)
|
||||
diff-lcs (1.3)
|
||||
docile (1.3.2)
|
||||
ffi (1.12.1)
|
||||
ffi (1.12.1-java)
|
||||
ffi (1.12.2)
|
||||
gherkin (5.1.0)
|
||||
i18n (1.8.2)
|
||||
concurrent-ruby (~> 1.0)
|
||||
jaro_winkler (1.5.4)
|
||||
jaro_winkler (1.5.4-java)
|
||||
jdbc-sqlite3 (3.28.0)
|
||||
json (2.3.0)
|
||||
json (2.3.0-java)
|
||||
minitest (5.14.0)
|
||||
multi_json (1.14.1)
|
||||
multi_test (0.1.2)
|
||||
parallel (1.19.1)
|
||||
parser (2.7.0.2)
|
||||
parser (2.7.1.1)
|
||||
ast (~> 2.4.0)
|
||||
rack (2.1.1)
|
||||
rack (2.2.2)
|
||||
rainbow (3.0.0)
|
||||
rake (13.0.1)
|
||||
rexml (3.2.4)
|
||||
rspec (3.9.0)
|
||||
rspec-core (~> 3.9.0)
|
||||
rspec-expectations (~> 3.9.0)
|
||||
rspec-mocks (~> 3.9.0)
|
||||
rspec-core (3.9.1)
|
||||
rspec-support (~> 3.9.1)
|
||||
rspec-expectations (3.9.0)
|
||||
rspec-expectations (3.9.1)
|
||||
diff-lcs (>= 1.2.0, < 2.0)
|
||||
rspec-support (~> 3.9.0)
|
||||
rspec-its (1.3.0)
|
||||
|
@ -93,36 +84,35 @@ GEM
|
|||
diff-lcs (>= 1.2.0, < 2.0)
|
||||
rspec-support (~> 3.9.0)
|
||||
rspec-support (3.9.2)
|
||||
rubocop (0.79.0)
|
||||
rubocop (0.82.0)
|
||||
jaro_winkler (~> 1.5.1)
|
||||
parallel (~> 1.10)
|
||||
parser (>= 2.7.0.1)
|
||||
rainbow (>= 2.2.2, < 4.0)
|
||||
rexml
|
||||
ruby-progressbar (~> 1.7)
|
||||
unicode-display_width (>= 1.4.0, < 1.7)
|
||||
unicode-display_width (>= 1.4.0, < 2.0)
|
||||
rubocop-performance (1.5.2)
|
||||
rubocop (>= 0.71.0)
|
||||
rubocop-rails (2.4.1)
|
||||
rubocop-rails (2.5.2)
|
||||
activesupport
|
||||
rack (>= 1.1)
|
||||
rubocop (>= 0.72.0)
|
||||
ruby-progressbar (1.10.1)
|
||||
simplecov (0.17.1)
|
||||
simplecov (0.18.5)
|
||||
docile (~> 1.1)
|
||||
json (>= 1.8, < 3)
|
||||
simplecov-html (~> 0.10.0)
|
||||
simplecov-html (0.10.2)
|
||||
simplecov-html (~> 0.11)
|
||||
simplecov-html (0.12.2)
|
||||
sqlite3 (1.4.2)
|
||||
thor (1.0.1)
|
||||
thread_safe (0.3.6)
|
||||
thread_safe (0.3.6-java)
|
||||
tzinfo (1.2.6)
|
||||
tzinfo (1.2.7)
|
||||
thread_safe (~> 0.1)
|
||||
unicode-display_width (1.6.1)
|
||||
unicode-display_width (1.7.0)
|
||||
yard (0.9.24)
|
||||
zeitwerk (2.2.2)
|
||||
zeitwerk (2.3.0)
|
||||
|
||||
PLATFORMS
|
||||
java
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
|
|
|
@ -15,7 +15,7 @@ Gem::Specification.new do |s|
|
|||
%w[CONTRIBUTING.md GETTING_STARTED.md LICENSE NAME.md NEWS.md README.md .yardopts]
|
||||
|
||||
s.require_path = "lib"
|
||||
s.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
|
||||
s.required_ruby_version = Gem::Requirement.new(">= 2.5.0")
|
||||
|
||||
s.authors = ["Josh Clayton", "Joe Ferris"]
|
||||
s.email = ["jclayton@thoughtbot.com", "jferris@thoughtbot.com"]
|
||||
|
@ -23,7 +23,7 @@ Gem::Specification.new do |s|
|
|||
s.homepage = "https://github.com/thoughtbot/factory_bot"
|
||||
s.metadata["changelog_uri"] = "https://github.com/thoughtbot/factory_bot/blob/master/NEWS.md"
|
||||
|
||||
s.add_dependency("activesupport", ">= 4.2.0")
|
||||
s.add_dependency("activesupport", ">= 5.0.0")
|
||||
|
||||
s.add_development_dependency("activerecord")
|
||||
s.add_development_dependency("appraisal")
|
||||
|
|
|
@ -3,14 +3,7 @@ ActiveRecord::Base.establish_connection(
|
|||
database: ":memory:",
|
||||
)
|
||||
|
||||
migration_class =
|
||||
if ActiveRecord::Migration.respond_to?(:[])
|
||||
ActiveRecord::Migration[4.2]
|
||||
else
|
||||
ActiveRecord::Migration
|
||||
end
|
||||
|
||||
class CreateSchema < migration_class
|
||||
class CreateSchema < ActiveRecord::Migration[5.0]
|
||||
def self.up
|
||||
create_table :categories, force: true do |t|
|
||||
t.string :name
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
# This file was generated by Appraisal
|
||||
|
||||
source "https://rubygems.org"
|
||||
|
||||
gem "activerecord-jdbcsqlite3-adapter", "~> 1.3.25", platforms: [:jruby]
|
||||
gem "sqlite3", "~> 1.3.6", platforms: [:ruby]
|
||||
gem "activerecord", "~> 4.2.11"
|
||||
|
||||
gemspec name: "factory_bot", path: "../"
|
|
@ -1,147 +0,0 @@
|
|||
PATH
|
||||
remote: ..
|
||||
specs:
|
||||
factory_bot (5.2.0)
|
||||
activesupport (>= 4.2.0)
|
||||
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
activemodel (4.2.11.1)
|
||||
activesupport (= 4.2.11.1)
|
||||
builder (~> 3.1)
|
||||
activerecord (4.2.11.1)
|
||||
activemodel (= 4.2.11.1)
|
||||
activesupport (= 4.2.11.1)
|
||||
arel (~> 6.0)
|
||||
activerecord-jdbc-adapter (1.3.25)
|
||||
activerecord (>= 2.2, < 5.0)
|
||||
activerecord-jdbcsqlite3-adapter (1.3.25)
|
||||
activerecord-jdbc-adapter (~> 1.3.25)
|
||||
jdbc-sqlite3 (>= 3.7.2, < 3.9)
|
||||
activesupport (4.2.11.1)
|
||||
i18n (~> 0.7)
|
||||
minitest (~> 5.1)
|
||||
thread_safe (~> 0.3, >= 0.3.4)
|
||||
tzinfo (~> 1.1)
|
||||
appraisal (2.2.0)
|
||||
bundler
|
||||
rake
|
||||
thor (>= 0.14.0)
|
||||
arel (6.0.4)
|
||||
aruba (0.14.14)
|
||||
childprocess (>= 0.6.3, < 4.0.0)
|
||||
contracts (~> 0.9)
|
||||
cucumber (>= 1.3.19)
|
||||
ffi (~> 1.9)
|
||||
rspec-expectations (>= 2.99)
|
||||
thor (>= 0.19, < 2.0)
|
||||
ast (2.4.0)
|
||||
backports (3.15.0)
|
||||
builder (3.2.4)
|
||||
childprocess (3.0.0)
|
||||
concurrent-ruby (1.1.5)
|
||||
contracts (0.16.0)
|
||||
cucumber (3.1.2)
|
||||
builder (>= 2.1.2)
|
||||
cucumber-core (~> 3.2.0)
|
||||
cucumber-expressions (~> 6.0.1)
|
||||
cucumber-wire (~> 0.0.1)
|
||||
diff-lcs (~> 1.3)
|
||||
gherkin (~> 5.1.0)
|
||||
multi_json (>= 1.7.5, < 2.0)
|
||||
multi_test (>= 0.1.2)
|
||||
cucumber-core (3.2.1)
|
||||
backports (>= 3.8.0)
|
||||
cucumber-tag_expressions (~> 1.1.0)
|
||||
gherkin (~> 5.0)
|
||||
cucumber-expressions (6.0.1)
|
||||
cucumber-tag_expressions (1.1.1)
|
||||
cucumber-wire (0.0.1)
|
||||
diff-lcs (1.3)
|
||||
docile (1.3.2)
|
||||
ffi (1.12.1)
|
||||
ffi (1.12.1-java)
|
||||
gherkin (5.1.0)
|
||||
i18n (0.9.5)
|
||||
concurrent-ruby (~> 1.0)
|
||||
jaro_winkler (1.5.4)
|
||||
jaro_winkler (1.5.4-java)
|
||||
jdbc-sqlite3 (3.8.11.2)
|
||||
json (2.3.0)
|
||||
json (2.3.0-java)
|
||||
minitest (5.14.0)
|
||||
multi_json (1.14.1)
|
||||
multi_test (0.1.2)
|
||||
parallel (1.19.1)
|
||||
parser (2.7.0.2)
|
||||
ast (~> 2.4.0)
|
||||
rack (2.1.1)
|
||||
rainbow (3.0.0)
|
||||
rake (13.0.1)
|
||||
rspec (3.9.0)
|
||||
rspec-core (~> 3.9.0)
|
||||
rspec-expectations (~> 3.9.0)
|
||||
rspec-mocks (~> 3.9.0)
|
||||
rspec-core (3.9.1)
|
||||
rspec-support (~> 3.9.1)
|
||||
rspec-expectations (3.9.0)
|
||||
diff-lcs (>= 1.2.0, < 2.0)
|
||||
rspec-support (~> 3.9.0)
|
||||
rspec-its (1.3.0)
|
||||
rspec-core (>= 3.0.0)
|
||||
rspec-expectations (>= 3.0.0)
|
||||
rspec-mocks (3.9.1)
|
||||
diff-lcs (>= 1.2.0, < 2.0)
|
||||
rspec-support (~> 3.9.0)
|
||||
rspec-support (3.9.2)
|
||||
rubocop (0.79.0)
|
||||
jaro_winkler (~> 1.5.1)
|
||||
parallel (~> 1.10)
|
||||
parser (>= 2.7.0.1)
|
||||
rainbow (>= 2.2.2, < 4.0)
|
||||
ruby-progressbar (~> 1.7)
|
||||
unicode-display_width (>= 1.4.0, < 1.7)
|
||||
rubocop-performance (1.5.2)
|
||||
rubocop (>= 0.71.0)
|
||||
rubocop-rails (2.4.1)
|
||||
rack (>= 1.1)
|
||||
rubocop (>= 0.72.0)
|
||||
ruby-progressbar (1.10.1)
|
||||
simplecov (0.17.1)
|
||||
docile (~> 1.1)
|
||||
json (>= 1.8, < 3)
|
||||
simplecov-html (~> 0.10.0)
|
||||
simplecov-html (0.10.2)
|
||||
sqlite3 (1.3.13)
|
||||
thor (1.0.1)
|
||||
thread_safe (0.3.6)
|
||||
thread_safe (0.3.6-java)
|
||||
tzinfo (1.2.6)
|
||||
thread_safe (~> 0.1)
|
||||
unicode-display_width (1.6.1)
|
||||
yard (0.9.24)
|
||||
|
||||
PLATFORMS
|
||||
java
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
activerecord (~> 4.2.11)
|
||||
activerecord-jdbcsqlite3-adapter (~> 1.3.25)
|
||||
appraisal
|
||||
aruba
|
||||
cucumber
|
||||
factory_bot!
|
||||
rake
|
||||
rspec
|
||||
rspec-its
|
||||
rubocop
|
||||
rubocop-performance
|
||||
rubocop-rails
|
||||
simplecov
|
||||
sqlite3 (~> 1.3.6)
|
||||
yard
|
||||
|
||||
BUNDLED WITH
|
||||
2.1.4
|
|
@ -2,7 +2,7 @@ PATH
|
|||
remote: ..
|
||||
specs:
|
||||
factory_bot (5.2.0)
|
||||
activesupport (>= 4.2.0)
|
||||
activesupport (>= 5.0.0)
|
||||
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
|
@ -13,11 +13,6 @@ GEM
|
|||
activemodel (= 5.0.7.2)
|
||||
activesupport (= 5.0.7.2)
|
||||
arel (~> 7.0)
|
||||
activerecord-jdbc-adapter (50.6-java)
|
||||
activerecord (~> 5.0.0, >= 5.0.3)
|
||||
activerecord-jdbcsqlite3-adapter (50.6-java)
|
||||
activerecord-jdbc-adapter (= 50.6)
|
||||
jdbc-sqlite3 (~> 3.8, < 3.30)
|
||||
activesupport (5.0.7.2)
|
||||
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||
i18n (>= 0.7, < 2)
|
||||
|
@ -28,18 +23,18 @@ GEM
|
|||
rake
|
||||
thor (>= 0.14.0)
|
||||
arel (7.1.4)
|
||||
aruba (0.14.14)
|
||||
childprocess (>= 0.6.3, < 4.0.0)
|
||||
contracts (~> 0.9)
|
||||
cucumber (>= 1.3.19)
|
||||
aruba (1.0.0)
|
||||
childprocess (~> 3.0)
|
||||
contracts (~> 0.16.0)
|
||||
cucumber (>= 2.4, < 4.0)
|
||||
ffi (~> 1.9)
|
||||
rspec-expectations (>= 2.99)
|
||||
thor (>= 0.19, < 2.0)
|
||||
rspec-expectations (~> 3.4)
|
||||
thor (~> 1.0)
|
||||
ast (2.4.0)
|
||||
backports (3.15.0)
|
||||
backports (3.17.1)
|
||||
builder (3.2.4)
|
||||
childprocess (3.0.0)
|
||||
concurrent-ruby (1.1.5)
|
||||
concurrent-ruby (1.1.6)
|
||||
contracts (0.16.0)
|
||||
cucumber (3.1.2)
|
||||
builder (>= 2.1.2)
|
||||
|
@ -59,32 +54,28 @@ GEM
|
|||
cucumber-wire (0.0.1)
|
||||
diff-lcs (1.3)
|
||||
docile (1.3.2)
|
||||
ffi (1.12.1)
|
||||
ffi (1.12.1-java)
|
||||
ffi (1.12.2)
|
||||
gherkin (5.1.0)
|
||||
i18n (1.8.2)
|
||||
concurrent-ruby (~> 1.0)
|
||||
jaro_winkler (1.5.4)
|
||||
jaro_winkler (1.5.4-java)
|
||||
jdbc-sqlite3 (3.28.0)
|
||||
json (2.3.0)
|
||||
json (2.3.0-java)
|
||||
minitest (5.14.0)
|
||||
multi_json (1.14.1)
|
||||
multi_test (0.1.2)
|
||||
parallel (1.19.1)
|
||||
parser (2.7.0.2)
|
||||
parser (2.7.1.1)
|
||||
ast (~> 2.4.0)
|
||||
rack (2.1.1)
|
||||
rack (2.2.2)
|
||||
rainbow (3.0.0)
|
||||
rake (13.0.1)
|
||||
rexml (3.2.4)
|
||||
rspec (3.9.0)
|
||||
rspec-core (~> 3.9.0)
|
||||
rspec-expectations (~> 3.9.0)
|
||||
rspec-mocks (~> 3.9.0)
|
||||
rspec-core (3.9.1)
|
||||
rspec-support (~> 3.9.1)
|
||||
rspec-expectations (3.9.0)
|
||||
rspec-expectations (3.9.1)
|
||||
diff-lcs (>= 1.2.0, < 2.0)
|
||||
rspec-support (~> 3.9.0)
|
||||
rspec-its (1.3.0)
|
||||
|
@ -94,35 +85,34 @@ GEM
|
|||
diff-lcs (>= 1.2.0, < 2.0)
|
||||
rspec-support (~> 3.9.0)
|
||||
rspec-support (3.9.2)
|
||||
rubocop (0.79.0)
|
||||
rubocop (0.82.0)
|
||||
jaro_winkler (~> 1.5.1)
|
||||
parallel (~> 1.10)
|
||||
parser (>= 2.7.0.1)
|
||||
rainbow (>= 2.2.2, < 4.0)
|
||||
rexml
|
||||
ruby-progressbar (~> 1.7)
|
||||
unicode-display_width (>= 1.4.0, < 1.7)
|
||||
unicode-display_width (>= 1.4.0, < 2.0)
|
||||
rubocop-performance (1.5.2)
|
||||
rubocop (>= 0.71.0)
|
||||
rubocop-rails (2.4.1)
|
||||
rubocop-rails (2.5.2)
|
||||
activesupport
|
||||
rack (>= 1.1)
|
||||
rubocop (>= 0.72.0)
|
||||
ruby-progressbar (1.10.1)
|
||||
simplecov (0.17.1)
|
||||
simplecov (0.18.5)
|
||||
docile (~> 1.1)
|
||||
json (>= 1.8, < 3)
|
||||
simplecov-html (~> 0.10.0)
|
||||
simplecov-html (0.10.2)
|
||||
simplecov-html (~> 0.11)
|
||||
simplecov-html (0.12.2)
|
||||
sqlite3 (1.3.13)
|
||||
thor (1.0.1)
|
||||
thread_safe (0.3.6)
|
||||
thread_safe (0.3.6-java)
|
||||
tzinfo (1.2.6)
|
||||
tzinfo (1.2.7)
|
||||
thread_safe (~> 0.1)
|
||||
unicode-display_width (1.6.1)
|
||||
unicode-display_width (1.7.0)
|
||||
yard (0.9.24)
|
||||
|
||||
PLATFORMS
|
||||
java
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
|
|
|
@ -2,7 +2,7 @@ PATH
|
|||
remote: ..
|
||||
specs:
|
||||
factory_bot (5.2.0)
|
||||
activesupport (>= 4.2.0)
|
||||
activesupport (>= 5.0.0)
|
||||
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
|
@ -13,11 +13,6 @@ GEM
|
|||
activemodel (= 5.1.7)
|
||||
activesupport (= 5.1.7)
|
||||
arel (~> 8.0)
|
||||
activerecord-jdbc-adapter (51.6-java)
|
||||
activerecord (~> 5.1.0)
|
||||
activerecord-jdbcsqlite3-adapter (51.6-java)
|
||||
activerecord-jdbc-adapter (= 51.6)
|
||||
jdbc-sqlite3 (~> 3.8, < 3.30)
|
||||
activesupport (5.1.7)
|
||||
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||
i18n (>= 0.7, < 2)
|
||||
|
@ -28,18 +23,18 @@ GEM
|
|||
rake
|
||||
thor (>= 0.14.0)
|
||||
arel (8.0.0)
|
||||
aruba (0.14.14)
|
||||
childprocess (>= 0.6.3, < 4.0.0)
|
||||
contracts (~> 0.9)
|
||||
cucumber (>= 1.3.19)
|
||||
aruba (1.0.0)
|
||||
childprocess (~> 3.0)
|
||||
contracts (~> 0.16.0)
|
||||
cucumber (>= 2.4, < 4.0)
|
||||
ffi (~> 1.9)
|
||||
rspec-expectations (>= 2.99)
|
||||
thor (>= 0.19, < 2.0)
|
||||
rspec-expectations (~> 3.4)
|
||||
thor (~> 1.0)
|
||||
ast (2.4.0)
|
||||
backports (3.15.0)
|
||||
backports (3.17.1)
|
||||
builder (3.2.4)
|
||||
childprocess (3.0.0)
|
||||
concurrent-ruby (1.1.5)
|
||||
concurrent-ruby (1.1.6)
|
||||
contracts (0.16.0)
|
||||
cucumber (3.1.2)
|
||||
builder (>= 2.1.2)
|
||||
|
@ -59,32 +54,28 @@ GEM
|
|||
cucumber-wire (0.0.1)
|
||||
diff-lcs (1.3)
|
||||
docile (1.3.2)
|
||||
ffi (1.12.1)
|
||||
ffi (1.12.1-java)
|
||||
ffi (1.12.2)
|
||||
gherkin (5.1.0)
|
||||
i18n (1.8.2)
|
||||
concurrent-ruby (~> 1.0)
|
||||
jaro_winkler (1.5.4)
|
||||
jaro_winkler (1.5.4-java)
|
||||
jdbc-sqlite3 (3.28.0)
|
||||
json (2.3.0)
|
||||
json (2.3.0-java)
|
||||
minitest (5.14.0)
|
||||
multi_json (1.14.1)
|
||||
multi_test (0.1.2)
|
||||
parallel (1.19.1)
|
||||
parser (2.7.0.2)
|
||||
parser (2.7.1.1)
|
||||
ast (~> 2.4.0)
|
||||
rack (2.1.1)
|
||||
rack (2.2.2)
|
||||
rainbow (3.0.0)
|
||||
rake (13.0.1)
|
||||
rexml (3.2.4)
|
||||
rspec (3.9.0)
|
||||
rspec-core (~> 3.9.0)
|
||||
rspec-expectations (~> 3.9.0)
|
||||
rspec-mocks (~> 3.9.0)
|
||||
rspec-core (3.9.1)
|
||||
rspec-support (~> 3.9.1)
|
||||
rspec-expectations (3.9.0)
|
||||
rspec-expectations (3.9.1)
|
||||
diff-lcs (>= 1.2.0, < 2.0)
|
||||
rspec-support (~> 3.9.0)
|
||||
rspec-its (1.3.0)
|
||||
|
@ -94,35 +85,34 @@ GEM
|
|||
diff-lcs (>= 1.2.0, < 2.0)
|
||||
rspec-support (~> 3.9.0)
|
||||
rspec-support (3.9.2)
|
||||
rubocop (0.79.0)
|
||||
rubocop (0.82.0)
|
||||
jaro_winkler (~> 1.5.1)
|
||||
parallel (~> 1.10)
|
||||
parser (>= 2.7.0.1)
|
||||
rainbow (>= 2.2.2, < 4.0)
|
||||
rexml
|
||||
ruby-progressbar (~> 1.7)
|
||||
unicode-display_width (>= 1.4.0, < 1.7)
|
||||
unicode-display_width (>= 1.4.0, < 2.0)
|
||||
rubocop-performance (1.5.2)
|
||||
rubocop (>= 0.71.0)
|
||||
rubocop-rails (2.4.1)
|
||||
rubocop-rails (2.5.2)
|
||||
activesupport
|
||||
rack (>= 1.1)
|
||||
rubocop (>= 0.72.0)
|
||||
ruby-progressbar (1.10.1)
|
||||
simplecov (0.17.1)
|
||||
simplecov (0.18.5)
|
||||
docile (~> 1.1)
|
||||
json (>= 1.8, < 3)
|
||||
simplecov-html (~> 0.10.0)
|
||||
simplecov-html (0.10.2)
|
||||
simplecov-html (~> 0.11)
|
||||
simplecov-html (0.12.2)
|
||||
sqlite3 (1.4.2)
|
||||
thor (1.0.1)
|
||||
thread_safe (0.3.6)
|
||||
thread_safe (0.3.6-java)
|
||||
tzinfo (1.2.6)
|
||||
tzinfo (1.2.7)
|
||||
thread_safe (~> 0.1)
|
||||
unicode-display_width (1.6.1)
|
||||
unicode-display_width (1.7.0)
|
||||
yard (0.9.24)
|
||||
|
||||
PLATFORMS
|
||||
java
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
|
|
|
@ -2,23 +2,18 @@ PATH
|
|||
remote: ..
|
||||
specs:
|
||||
factory_bot (5.2.0)
|
||||
activesupport (>= 4.2.0)
|
||||
activesupport (>= 5.0.0)
|
||||
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
activemodel (5.2.4.1)
|
||||
activesupport (= 5.2.4.1)
|
||||
activerecord (5.2.4.1)
|
||||
activemodel (= 5.2.4.1)
|
||||
activesupport (= 5.2.4.1)
|
||||
activemodel (5.2.4.2)
|
||||
activesupport (= 5.2.4.2)
|
||||
activerecord (5.2.4.2)
|
||||
activemodel (= 5.2.4.2)
|
||||
activesupport (= 5.2.4.2)
|
||||
arel (>= 9.0)
|
||||
activerecord-jdbc-adapter (52.5-java)
|
||||
activerecord (~> 5.2.0)
|
||||
activerecord-jdbcsqlite3-adapter (52.5-java)
|
||||
activerecord-jdbc-adapter (= 52.5)
|
||||
jdbc-sqlite3 (~> 3.8, < 3.30)
|
||||
activesupport (5.2.4.1)
|
||||
activesupport (5.2.4.2)
|
||||
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||
i18n (>= 0.7, < 2)
|
||||
minitest (~> 5.1)
|
||||
|
@ -28,18 +23,18 @@ GEM
|
|||
rake
|
||||
thor (>= 0.14.0)
|
||||
arel (9.0.0)
|
||||
aruba (0.14.14)
|
||||
childprocess (>= 0.6.3, < 4.0.0)
|
||||
contracts (~> 0.9)
|
||||
cucumber (>= 1.3.19)
|
||||
aruba (1.0.0)
|
||||
childprocess (~> 3.0)
|
||||
contracts (~> 0.16.0)
|
||||
cucumber (>= 2.4, < 4.0)
|
||||
ffi (~> 1.9)
|
||||
rspec-expectations (>= 2.99)
|
||||
thor (>= 0.19, < 2.0)
|
||||
rspec-expectations (~> 3.4)
|
||||
thor (~> 1.0)
|
||||
ast (2.4.0)
|
||||
backports (3.15.0)
|
||||
backports (3.17.1)
|
||||
builder (3.2.4)
|
||||
childprocess (3.0.0)
|
||||
concurrent-ruby (1.1.5)
|
||||
concurrent-ruby (1.1.6)
|
||||
contracts (0.16.0)
|
||||
cucumber (3.1.2)
|
||||
builder (>= 2.1.2)
|
||||
|
@ -59,32 +54,28 @@ GEM
|
|||
cucumber-wire (0.0.1)
|
||||
diff-lcs (1.3)
|
||||
docile (1.3.2)
|
||||
ffi (1.12.1)
|
||||
ffi (1.12.1-java)
|
||||
ffi (1.12.2)
|
||||
gherkin (5.1.0)
|
||||
i18n (1.8.2)
|
||||
concurrent-ruby (~> 1.0)
|
||||
jaro_winkler (1.5.4)
|
||||
jaro_winkler (1.5.4-java)
|
||||
jdbc-sqlite3 (3.28.0)
|
||||
json (2.3.0)
|
||||
json (2.3.0-java)
|
||||
minitest (5.14.0)
|
||||
multi_json (1.14.1)
|
||||
multi_test (0.1.2)
|
||||
parallel (1.19.1)
|
||||
parser (2.7.0.2)
|
||||
parser (2.7.1.1)
|
||||
ast (~> 2.4.0)
|
||||
rack (2.1.1)
|
||||
rack (2.2.2)
|
||||
rainbow (3.0.0)
|
||||
rake (13.0.1)
|
||||
rexml (3.2.4)
|
||||
rspec (3.9.0)
|
||||
rspec-core (~> 3.9.0)
|
||||
rspec-expectations (~> 3.9.0)
|
||||
rspec-mocks (~> 3.9.0)
|
||||
rspec-core (3.9.1)
|
||||
rspec-support (~> 3.9.1)
|
||||
rspec-expectations (3.9.0)
|
||||
rspec-expectations (3.9.1)
|
||||
diff-lcs (>= 1.2.0, < 2.0)
|
||||
rspec-support (~> 3.9.0)
|
||||
rspec-its (1.3.0)
|
||||
|
@ -94,35 +85,34 @@ GEM
|
|||
diff-lcs (>= 1.2.0, < 2.0)
|
||||
rspec-support (~> 3.9.0)
|
||||
rspec-support (3.9.2)
|
||||
rubocop (0.79.0)
|
||||
rubocop (0.82.0)
|
||||
jaro_winkler (~> 1.5.1)
|
||||
parallel (~> 1.10)
|
||||
parser (>= 2.7.0.1)
|
||||
rainbow (>= 2.2.2, < 4.0)
|
||||
rexml
|
||||
ruby-progressbar (~> 1.7)
|
||||
unicode-display_width (>= 1.4.0, < 1.7)
|
||||
unicode-display_width (>= 1.4.0, < 2.0)
|
||||
rubocop-performance (1.5.2)
|
||||
rubocop (>= 0.71.0)
|
||||
rubocop-rails (2.4.1)
|
||||
rubocop-rails (2.5.2)
|
||||
activesupport
|
||||
rack (>= 1.1)
|
||||
rubocop (>= 0.72.0)
|
||||
ruby-progressbar (1.10.1)
|
||||
simplecov (0.17.1)
|
||||
simplecov (0.18.5)
|
||||
docile (~> 1.1)
|
||||
json (>= 1.8, < 3)
|
||||
simplecov-html (~> 0.10.0)
|
||||
simplecov-html (0.10.2)
|
||||
simplecov-html (~> 0.11)
|
||||
simplecov-html (0.12.2)
|
||||
sqlite3 (1.4.2)
|
||||
thor (1.0.1)
|
||||
thread_safe (0.3.6)
|
||||
thread_safe (0.3.6-java)
|
||||
tzinfo (1.2.6)
|
||||
tzinfo (1.2.7)
|
||||
thread_safe (~> 0.1)
|
||||
unicode-display_width (1.6.1)
|
||||
unicode-display_width (1.7.0)
|
||||
yard (0.9.24)
|
||||
|
||||
PLATFORMS
|
||||
java
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
|
|
|
@ -2,22 +2,17 @@ PATH
|
|||
remote: ..
|
||||
specs:
|
||||
factory_bot (5.2.0)
|
||||
activesupport (>= 4.2.0)
|
||||
activesupport (>= 5.0.0)
|
||||
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
activemodel (6.0.2.1)
|
||||
activesupport (= 6.0.2.1)
|
||||
activerecord (6.0.2.1)
|
||||
activemodel (= 6.0.2.1)
|
||||
activesupport (= 6.0.2.1)
|
||||
activerecord-jdbc-adapter (60.1-java)
|
||||
activerecord (~> 6.0.0)
|
||||
activerecord-jdbcsqlite3-adapter (60.1-java)
|
||||
activerecord-jdbc-adapter (= 60.1)
|
||||
jdbc-sqlite3 (~> 3.8, < 3.30)
|
||||
activesupport (6.0.2.1)
|
||||
activemodel (6.0.2.2)
|
||||
activesupport (= 6.0.2.2)
|
||||
activerecord (6.0.2.2)
|
||||
activemodel (= 6.0.2.2)
|
||||
activesupport (= 6.0.2.2)
|
||||
activesupport (6.0.2.2)
|
||||
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||
i18n (>= 0.7, < 2)
|
||||
minitest (~> 5.1)
|
||||
|
@ -27,18 +22,18 @@ GEM
|
|||
bundler
|
||||
rake
|
||||
thor (>= 0.14.0)
|
||||
aruba (0.14.14)
|
||||
childprocess (>= 0.6.3, < 4.0.0)
|
||||
contracts (~> 0.9)
|
||||
cucumber (>= 1.3.19)
|
||||
aruba (1.0.0)
|
||||
childprocess (~> 3.0)
|
||||
contracts (~> 0.16.0)
|
||||
cucumber (>= 2.4, < 4.0)
|
||||
ffi (~> 1.9)
|
||||
rspec-expectations (>= 2.99)
|
||||
thor (>= 0.19, < 2.0)
|
||||
rspec-expectations (~> 3.4)
|
||||
thor (~> 1.0)
|
||||
ast (2.4.0)
|
||||
backports (3.15.0)
|
||||
backports (3.17.1)
|
||||
builder (3.2.4)
|
||||
childprocess (3.0.0)
|
||||
concurrent-ruby (1.1.5)
|
||||
concurrent-ruby (1.1.6)
|
||||
contracts (0.16.0)
|
||||
cucumber (3.1.2)
|
||||
builder (>= 2.1.2)
|
||||
|
@ -58,32 +53,28 @@ GEM
|
|||
cucumber-wire (0.0.1)
|
||||
diff-lcs (1.3)
|
||||
docile (1.3.2)
|
||||
ffi (1.12.1)
|
||||
ffi (1.12.1-java)
|
||||
ffi (1.12.2)
|
||||
gherkin (5.1.0)
|
||||
i18n (1.8.2)
|
||||
concurrent-ruby (~> 1.0)
|
||||
jaro_winkler (1.5.4)
|
||||
jaro_winkler (1.5.4-java)
|
||||
jdbc-sqlite3 (3.28.0)
|
||||
json (2.3.0)
|
||||
json (2.3.0-java)
|
||||
minitest (5.14.0)
|
||||
multi_json (1.14.1)
|
||||
multi_test (0.1.2)
|
||||
parallel (1.19.1)
|
||||
parser (2.7.0.2)
|
||||
parser (2.7.1.1)
|
||||
ast (~> 2.4.0)
|
||||
rack (2.1.1)
|
||||
rack (2.2.2)
|
||||
rainbow (3.0.0)
|
||||
rake (13.0.1)
|
||||
rexml (3.2.4)
|
||||
rspec (3.9.0)
|
||||
rspec-core (~> 3.9.0)
|
||||
rspec-expectations (~> 3.9.0)
|
||||
rspec-mocks (~> 3.9.0)
|
||||
rspec-core (3.9.1)
|
||||
rspec-support (~> 3.9.1)
|
||||
rspec-expectations (3.9.0)
|
||||
rspec-expectations (3.9.1)
|
||||
diff-lcs (>= 1.2.0, < 2.0)
|
||||
rspec-support (~> 3.9.0)
|
||||
rspec-its (1.3.0)
|
||||
|
@ -93,36 +84,35 @@ GEM
|
|||
diff-lcs (>= 1.2.0, < 2.0)
|
||||
rspec-support (~> 3.9.0)
|
||||
rspec-support (3.9.2)
|
||||
rubocop (0.79.0)
|
||||
rubocop (0.82.0)
|
||||
jaro_winkler (~> 1.5.1)
|
||||
parallel (~> 1.10)
|
||||
parser (>= 2.7.0.1)
|
||||
rainbow (>= 2.2.2, < 4.0)
|
||||
rexml
|
||||
ruby-progressbar (~> 1.7)
|
||||
unicode-display_width (>= 1.4.0, < 1.7)
|
||||
unicode-display_width (>= 1.4.0, < 2.0)
|
||||
rubocop-performance (1.5.2)
|
||||
rubocop (>= 0.71.0)
|
||||
rubocop-rails (2.4.1)
|
||||
rubocop-rails (2.5.2)
|
||||
activesupport
|
||||
rack (>= 1.1)
|
||||
rubocop (>= 0.72.0)
|
||||
ruby-progressbar (1.10.1)
|
||||
simplecov (0.17.1)
|
||||
simplecov (0.18.5)
|
||||
docile (~> 1.1)
|
||||
json (>= 1.8, < 3)
|
||||
simplecov-html (~> 0.10.0)
|
||||
simplecov-html (0.10.2)
|
||||
simplecov-html (~> 0.11)
|
||||
simplecov-html (0.12.2)
|
||||
sqlite3 (1.4.2)
|
||||
thor (1.0.1)
|
||||
thread_safe (0.3.6)
|
||||
thread_safe (0.3.6-java)
|
||||
tzinfo (1.2.6)
|
||||
tzinfo (1.2.7)
|
||||
thread_safe (~> 0.1)
|
||||
unicode-display_width (1.6.1)
|
||||
unicode-display_width (1.7.0)
|
||||
yard (0.9.24)
|
||||
zeitwerk (2.2.2)
|
||||
zeitwerk (2.3.0)
|
||||
|
||||
PLATFORMS
|
||||
java
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
|
|
|
@ -48,7 +48,7 @@ require "factory_bot/linter"
|
|||
require "factory_bot/version"
|
||||
|
||||
module FactoryBot
|
||||
Deprecation = ActiveSupport::Deprecation.new("6.0", "factory_bot")
|
||||
Deprecation = ActiveSupport::Deprecation.new("7.0", "factory_bot")
|
||||
|
||||
mattr_accessor :use_parent_strategy, instance_accessor: false
|
||||
self.use_parent_strategy = true
|
||||
|
@ -76,57 +76,11 @@ module FactoryBot
|
|||
end
|
||||
|
||||
class << self
|
||||
delegate :callback_names,
|
||||
:callbacks,
|
||||
:configuration,
|
||||
:constructor,
|
||||
:factories,
|
||||
:factory_by_name,
|
||||
:initialize_with,
|
||||
:register_callback,
|
||||
:register_default_callbacks,
|
||||
:register_default_strategies,
|
||||
:register_factory,
|
||||
:register_sequence,
|
||||
delegate :factories,
|
||||
:register_strategy,
|
||||
:register_trait,
|
||||
:reset_configuration,
|
||||
:rewind_sequences,
|
||||
:sequence_by_name,
|
||||
:sequences,
|
||||
:skip_create,
|
||||
:strategies,
|
||||
:strategy_by_name,
|
||||
:to_create,
|
||||
:trait_by_name,
|
||||
:traits,
|
||||
to: Internal
|
||||
|
||||
attr_accessor :allow_class_lookup
|
||||
|
||||
deprecate :allow_class_lookup,
|
||||
:allow_class_lookup=,
|
||||
:callback_names,
|
||||
:callbacks,
|
||||
:configuration,
|
||||
:constructor,
|
||||
:factory_by_name,
|
||||
:initialize_with,
|
||||
:register_callback,
|
||||
:register_default_callbacks,
|
||||
:register_default_strategies,
|
||||
:register_factory,
|
||||
:register_sequence,
|
||||
:register_trait,
|
||||
:reset_configuration,
|
||||
:sequence_by_name,
|
||||
:sequences,
|
||||
:skip_create,
|
||||
:strategies,
|
||||
:to_create,
|
||||
:trait_by_name,
|
||||
:traits,
|
||||
deprecator: Deprecation
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ module FactoryBot
|
|||
class_attribute :attribute_lists
|
||||
|
||||
private_instance_methods.each do |method|
|
||||
undef_method(method) unless method =~ /^__|initialize/
|
||||
undef_method(method) unless method.match?(/^__|initialize/)
|
||||
end
|
||||
|
||||
def initialize(build_strategy, overrides = {})
|
||||
|
|
|
@ -81,12 +81,9 @@ module FactoryBot
|
|||
def lint_traits(factory)
|
||||
result = []
|
||||
factory.definition.defined_traits.map(&:name).each do |trait_name|
|
||||
begin
|
||||
FactoryBot.public_send(factory_strategy, factory.name, trait_name)
|
||||
rescue StandardError => e
|
||||
result |=
|
||||
[FactoryTraitError.new(e, factory, trait_name)]
|
||||
end
|
||||
FactoryBot.public_send(factory_strategy, factory.name, trait_name)
|
||||
rescue StandardError => e
|
||||
result |= [FactoryTraitError.new(e, factory, trait_name)]
|
||||
end
|
||||
result
|
||||
end
|
||||
|
|
|
@ -1,23 +1,4 @@
|
|||
describe FactoryBot do
|
||||
it "finds a registered factory", :silence_deprecation do
|
||||
factory = FactoryBot::Factory.new(:object)
|
||||
FactoryBot.register_factory(factory)
|
||||
|
||||
expect(FactoryBot.factory_by_name(factory.name)).to eq factory
|
||||
end
|
||||
|
||||
it "finds a registered sequence", :silence_deprecation do
|
||||
sequence = FactoryBot::Sequence.new(:email)
|
||||
FactoryBot.register_sequence(sequence)
|
||||
expect(FactoryBot.sequence_by_name(sequence.name)).to eq sequence
|
||||
end
|
||||
|
||||
it "finds a registered trait", :silence_deprecation do
|
||||
trait = FactoryBot::Trait.new(:admin)
|
||||
FactoryBot.register_trait(trait)
|
||||
expect(FactoryBot.trait_by_name(trait.name)).to eq trait
|
||||
end
|
||||
|
||||
it "finds a registered strategy" do
|
||||
FactoryBot.register_strategy(:strategy_name, :strategy_class)
|
||||
expect(FactoryBot.strategy_by_name(:strategy_name)).
|
||||
|
|
Loading…
Reference in New Issue