rake
rake copied to clipboard
Minor version change (12.3.2 => 12.3.3) causes breakage in Shoulda
Hello! First off I want to apologize, I'm not a ruby whiz but I'll try to document this the best I can.
I ran into the following error when trying to build a project after a minor code change. (whitespace padding trimmed)
NameError: uninitialized constant Shoulda::InstanceMethods
const_missing at org/jruby/RubyModule.java:3372
<class:TestCase> at /usr/share/rvm/gems/jruby-9.1.16.0@PROJECT_NAME/gems/shoulda-2.11.3/lib/shoulda/integrations/test_unit.rb:14
<module:Unit> at /usr/share/rvm/gems/jruby-9.1.16.0@PROJECT_NAME/gems/shoulda-2.11.3/lib/shoulda/integrations/test_unit.rb:13
<module:Test> at /usr/share/rvm/gems/jruby-9.1.16.0@PROJECT_NAME/gems/shoulda-2.11.3/lib/shoulda/integrations/test_unit.rb:12
<main> at /usr/share/rvm/gems/jruby-9.1.16.0@PROJECT_NAME/gems/shoulda-2.11.3/lib/shoulda/integrations/test_unit.rb:11
require at org/jruby/RubyKernel.java:956
<main> at /usr/share/rvm/gems/jruby-9.1.16.0@PROJECT_NAME/gems/shoulda-2.11.3/lib/shoulda.rb:1
require at org/jruby/RubyKernel.java:956
<main> at /usr/share/rvm/gems/jruby-9.1.16.0@PROJECT_NAME/gems/shoulda-2.11.3/lib/shoulda.rb:8
require at org/jruby/RubyKernel.java:956
block in /usr/share/rvm/gems/jruby-9.1.16.0@PROJECT_NAME/gems/rake-12.3.3/lib/rake/rake_test_loader.rb at /usr/share/rvm/gems/jruby-9.1.16.0@PROJECT_NAME/gems/rake-12.3.3/lib/rake/rake_test_loader.rb:17
select at org/jruby/RubyArray.java:2566
<main> at /usr/share/rvm/gems/jruby-9.1.16.0@PROJECT_NAME/gems/rake-12.3.3/lib/rake/rake_test_loader.rb:5
The code change was in a different section of the repository and not related, so I immediately assumed it was breakage caused by a dependency resolution error. I pulled up the logs for a previous successful build and compared, and found the only difference was in rake
$ diff success.deps failure.deps
< Using rake 12.3.2
---
> Fetching rake 12.3.3
> Installing rake 12.3.3
$ cat failure.deps
Resolving dependencies......
Fetching rake 12.3.3
Installing rake 12.3.3
...
( other unchanged libraries )
...
Fetching shoulda 2.11.3
Installing shoulda 2.11.3
Fetching shoulda-context 1.2.2
Installing shoulda-context 1.2.2
Fetching shoulda-matchers 4.0.1
Installing shoulda-matchers 4.0.1
My gemfile calls gemspec
, my <project>.gemspec
has these relevant pins:
Gem::Specification.new do |s|
<...>
s.add_development_dependency "rake"
# Can unpin after upgrading to JRuby 9.2.+
s.add_development_dependency "shoulda-context", "~>1.2.2"
s.add_development_dependency "shoulda-matchers", "~>4.0.1"
<...>
end
I was able to resolve the error and build successfully by pinning:
s.add_development_dependency "rake", "12.3.2"
I'm cross-posting here and on Shoulda with all the relevant info in the hopes that the root cause of the bug can be identified and fixed in future versions. Let me know if there's any other info I should provide, such as a simple PoC to replicate the error.