Get default strategy registration working on JRuby

fixes #1331

The commit avoids a bug in JRuby, and adds JRuby back to the test matrix
so we can catch regressions in the future.
This commit is contained in:
Matijs van Zuijlen 2019-10-02 18:55:51 -04:00 committed by Daniel Colson
parent 94ce2be88f
commit 24f6d212f5
No known key found for this signature in database
GPG Key ID: 88A364BBE77B1353
17 changed files with 97 additions and 12 deletions

View File

@ -3,6 +3,7 @@ rvm:
- 2.4
- 2.5
- 2.6
- jruby-9.2.8.0
- ruby-head
before_install:
- gem update --system

View File

@ -1,21 +1,29 @@
appraise "4.2" do
gem "activerecord", "~> 4.2.11"
gem "sqlite3", "~> 1.3.6"
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 "sqlite3", "~> 1.3.6"
gem "activerecord-jdbcsqlite3-adapter", platforms: [:jruby]
gem "sqlite3", "~> 1.3.6", platforms: [:ruby]
end
appraise "5.1" do
gem "activerecord", "~> 5.1.7"
gem "activerecord-jdbcsqlite3-adapter", platforms: [:jruby]
gem "sqlite3", platforms: [:ruby]
end
appraise "5.2" do
gem "activerecord", "~> 5.2.3"
gem "activerecord-jdbcsqlite3-adapter", platforms: [:jruby]
gem "sqlite3", platforms: [:ruby]
end
appraise "6.0" do
gem "activerecord", "~> 6.0.0"
gem "activerecord-jdbcsqlite3-adapter", "~> 60.0.rc1", platforms: [:jruby]
gem "sqlite3", platforms: [:ruby]
end

View File

@ -1,3 +1,6 @@
source "https://rubygems.org"
gem "activerecord-jdbcsqlite3-adapter", platforms: [:jruby]
gem "sqlite3", platforms: [:ruby]
gemspec name: "factory_bot"

View File

@ -13,6 +13,11 @@ GEM
activemodel (= 5.2.3)
activesupport (= 5.2.3)
arel (>= 9.0)
activerecord-jdbc-adapter (52.3-java)
activerecord (~> 5.2.0)
activerecord-jdbcsqlite3-adapter (52.3-java)
activerecord-jdbc-adapter (= 52.3)
jdbc-sqlite3 (~> 3.8, < 3.30)
activesupport (5.2.3)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
@ -56,10 +61,13 @@ GEM
diff-lcs (1.3)
docile (1.3.2)
ffi (1.11.1)
ffi (1.11.1-java)
gherkin (5.1.0)
i18n (1.6.0)
concurrent-ruby (~> 1.0)
jdbc-sqlite3 (3.28.0)
json (2.2.0)
json (2.2.0-java)
minitest (5.11.3)
multi_json (1.13.1)
multi_test (0.1.2)
@ -101,16 +109,19 @@ GEM
sqlite3 (1.4.1)
thor (0.20.3)
thread_safe (0.3.6)
thread_safe (0.3.6-java)
tzinfo (1.2.5)
thread_safe (~> 0.1)
unicode-display_width (1.6.0)
yard (0.9.20)
PLATFORMS
java
ruby
DEPENDENCIES
activerecord
activerecord-jdbcsqlite3-adapter
appraisal
aruba
cucumber

View File

@ -33,7 +33,6 @@ Gem::Specification.new do |s|
s.add_development_dependency("rspec-its")
s.add_development_dependency("rubocop", "0.54")
s.add_development_dependency("simplecov")
s.add_development_dependency("sqlite3")
s.add_development_dependency("yard")
s.license = "MIT"

View File

@ -2,7 +2,8 @@
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"
gem "sqlite3", "~> 1.3.6"
gemspec name: "factory_bot", path: "../"

View File

@ -1,7 +1,7 @@
PATH
remote: ..
specs:
factory_bot (5.0.2)
factory_bot (5.1.0)
activesupport (>= 4.2.0)
GEM
@ -14,6 +14,11 @@ GEM
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)
@ -57,10 +62,13 @@ GEM
diff-lcs (1.3)
docile (1.3.2)
ffi (1.11.1)
ffi (1.11.1-java)
gherkin (5.1.0)
i18n (0.9.5)
concurrent-ruby (~> 1.0)
jdbc-sqlite3 (3.8.11.2)
json (2.2.0)
json (2.2.0-java)
minitest (5.11.3)
multi_json (1.13.1)
multi_test (0.1.2)
@ -102,16 +110,19 @@ GEM
sqlite3 (1.3.13)
thor (0.20.3)
thread_safe (0.3.6)
thread_safe (0.3.6-java)
tzinfo (1.2.5)
thread_safe (~> 0.1)
unicode-display_width (1.6.0)
yard (0.9.19)
PLATFORMS
java
ruby
DEPENDENCIES
activerecord (~> 4.2.11)
activerecord-jdbcsqlite3-adapter (~> 1.3.25)
appraisal
aruba
cucumber

View File

@ -2,7 +2,8 @@
source "https://rubygems.org"
gem "activerecord-jdbcsqlite3-adapter", platforms: [:jruby]
gem "sqlite3", "~> 1.3.6", platforms: [:ruby]
gem "activerecord", "~> 5.0.7"
gem "sqlite3", "~> 1.3.6"
gemspec name: "factory_bot", path: "../"

View File

@ -1,7 +1,7 @@
PATH
remote: ..
specs:
factory_bot (5.0.2)
factory_bot (5.1.0)
activesupport (>= 4.2.0)
GEM
@ -13,6 +13,11 @@ GEM
activemodel (= 5.0.7.2)
activesupport (= 5.0.7.2)
arel (~> 7.0)
activerecord-jdbc-adapter (50.4-java)
activerecord (~> 5.0.0, >= 5.0.3)
activerecord-jdbcsqlite3-adapter (50.4-java)
activerecord-jdbc-adapter (= 50.4)
jdbc-sqlite3 (~> 3.8, < 3.30)
activesupport (5.0.7.2)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
@ -56,10 +61,13 @@ GEM
diff-lcs (1.3)
docile (1.3.2)
ffi (1.11.1)
ffi (1.11.1-java)
gherkin (5.1.0)
i18n (1.6.0)
concurrent-ruby (~> 1.0)
jdbc-sqlite3 (3.28.0)
json (2.2.0)
json (2.2.0-java)
minitest (5.11.3)
multi_json (1.13.1)
multi_test (0.1.2)
@ -101,16 +109,19 @@ GEM
sqlite3 (1.3.13)
thor (0.20.3)
thread_safe (0.3.6)
thread_safe (0.3.6-java)
tzinfo (1.2.5)
thread_safe (~> 0.1)
unicode-display_width (1.6.0)
yard (0.9.19)
PLATFORMS
java
ruby
DEPENDENCIES
activerecord (~> 5.0.7)
activerecord-jdbcsqlite3-adapter
appraisal
aruba
cucumber

View File

@ -2,6 +2,8 @@
source "https://rubygems.org"
gem "activerecord-jdbcsqlite3-adapter", platforms: [:jruby]
gem "sqlite3", platforms: [:ruby]
gem "activerecord", "~> 5.1.7"
gemspec name: "factory_bot", path: "../"

View File

@ -1,7 +1,7 @@
PATH
remote: ..
specs:
factory_bot (5.0.2)
factory_bot (5.1.0)
activesupport (>= 4.2.0)
GEM
@ -13,6 +13,11 @@ GEM
activemodel (= 5.1.7)
activesupport (= 5.1.7)
arel (~> 8.0)
activerecord-jdbc-adapter (51.4-java)
activerecord (~> 5.1.0)
activerecord-jdbcsqlite3-adapter (51.4-java)
activerecord-jdbc-adapter (= 51.4)
jdbc-sqlite3 (~> 3.8, < 3.30)
activesupport (5.1.7)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
@ -56,10 +61,13 @@ GEM
diff-lcs (1.3)
docile (1.3.2)
ffi (1.11.1)
ffi (1.11.1-java)
gherkin (5.1.0)
i18n (1.6.0)
concurrent-ruby (~> 1.0)
jdbc-sqlite3 (3.28.0)
json (2.2.0)
json (2.2.0-java)
minitest (5.11.3)
multi_json (1.13.1)
multi_test (0.1.2)
@ -101,16 +109,19 @@ GEM
sqlite3 (1.4.1)
thor (0.20.3)
thread_safe (0.3.6)
thread_safe (0.3.6-java)
tzinfo (1.2.5)
thread_safe (~> 0.1)
unicode-display_width (1.6.0)
yard (0.9.19)
PLATFORMS
java
ruby
DEPENDENCIES
activerecord (~> 5.1.7)
activerecord-jdbcsqlite3-adapter
appraisal
aruba
cucumber

View File

@ -2,6 +2,8 @@
source "https://rubygems.org"
gem "activerecord-jdbcsqlite3-adapter", platforms: [:jruby]
gem "sqlite3", platforms: [:ruby]
gem "activerecord", "~> 5.2.3"
gemspec name: "factory_bot", path: "../"

View File

@ -1,7 +1,7 @@
PATH
remote: ..
specs:
factory_bot (5.0.2)
factory_bot (5.1.0)
activesupport (>= 4.2.0)
GEM
@ -13,6 +13,11 @@ GEM
activemodel (= 5.2.3)
activesupport (= 5.2.3)
arel (>= 9.0)
activerecord-jdbc-adapter (52.3-java)
activerecord (~> 5.2.0)
activerecord-jdbcsqlite3-adapter (52.3-java)
activerecord-jdbc-adapter (= 52.3)
jdbc-sqlite3 (~> 3.8, < 3.30)
activesupport (5.2.3)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
@ -56,10 +61,13 @@ GEM
diff-lcs (1.3)
docile (1.3.2)
ffi (1.11.1)
ffi (1.11.1-java)
gherkin (5.1.0)
i18n (1.6.0)
concurrent-ruby (~> 1.0)
jdbc-sqlite3 (3.28.0)
json (2.2.0)
json (2.2.0-java)
minitest (5.11.3)
multi_json (1.13.1)
multi_test (0.1.2)
@ -101,16 +109,19 @@ GEM
sqlite3 (1.4.1)
thor (0.20.3)
thread_safe (0.3.6)
thread_safe (0.3.6-java)
tzinfo (1.2.5)
thread_safe (~> 0.1)
unicode-display_width (1.6.0)
yard (0.9.19)
PLATFORMS
java
ruby
DEPENDENCIES
activerecord (~> 5.2.3)
activerecord-jdbcsqlite3-adapter
appraisal
aruba
cucumber

View File

@ -2,6 +2,8 @@
source "https://rubygems.org"
gem "activerecord-jdbcsqlite3-adapter", "~> 60.0.rc1", platforms: [:jruby]
gem "sqlite3", platforms: [:ruby]
gem "activerecord", "~> 6.0.0"
gemspec name: "factory_bot", path: "../"

View File

@ -1,7 +1,7 @@
PATH
remote: ..
specs:
factory_bot (5.0.2)
factory_bot (5.1.0)
activesupport (>= 4.2.0)
GEM
@ -12,6 +12,11 @@ GEM
activerecord (6.0.0)
activemodel (= 6.0.0)
activesupport (= 6.0.0)
activerecord-jdbc-adapter (60.0.rc1-java)
activerecord (~> 6.0.0.rc1)
activerecord-jdbcsqlite3-adapter (60.0.rc1-java)
activerecord-jdbc-adapter (= 60.0.rc1)
jdbc-sqlite3 (~> 3.8, < 3.30)
activesupport (6.0.0)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
@ -55,10 +60,13 @@ GEM
diff-lcs (1.3)
docile (1.3.2)
ffi (1.11.1)
ffi (1.11.1-java)
gherkin (5.1.0)
i18n (1.6.0)
concurrent-ruby (~> 1.0)
jdbc-sqlite3 (3.28.0)
json (2.2.0)
json (2.2.0-java)
minitest (5.11.3)
multi_json (1.13.1)
multi_test (0.1.2)
@ -100,6 +108,7 @@ GEM
sqlite3 (1.4.1)
thor (0.20.3)
thread_safe (0.3.6)
thread_safe (0.3.6-java)
tzinfo (1.2.5)
thread_safe (~> 0.1)
unicode-display_width (1.6.0)
@ -107,10 +116,12 @@ GEM
zeitwerk (2.1.9)
PLATFORMS
java
ruby
DEPENDENCIES
activerecord (~> 6.0.0)
activerecord-jdbcsqlite3-adapter (~> 60.0.rc1)
appraisal
aruba
cucumber

View File

@ -86,7 +86,7 @@ module FactoryBot
end
def register_default_strategies
DEFAULT_STRATEGIES.each(&method(:register_strategy))
DEFAULT_STRATEGIES.each { |name, klass| register_strategy(name, klass) }
end
def register_default_callbacks

View File

@ -11,7 +11,7 @@ describe "finding factories keyed by class instead of symbol" do
it "doesn't find the factory" do
expect { FactoryBot.create(User) }.to(
raise_error(KeyError, "Factory not registered: #{User.inspect}"),
raise_error(KeyError, /Factory not registered: User/),
)
end
end