Vít Ondruch wrote on 2023/10/30 20:43:
Dne 29. 10. 23 v 9:09 Mamoru TASAKA napsal(a):
> 14.
> rubygem-shoulda-matchers
>
https://copr.fedorainfracloud.org/coprs/mtasaka/rubygem-newruby-test-3-2/...
> Lots of:
> ```
> An error occurred while loading
./spec/unit/shoulda/matchers/action_controller/callback_matcher_spec.rb.
> Failure/Error: require 'unit_spec_helper'
>
> NoMethodError:
> undefined method `tr' for an instance of Pathname
> ```
> Not sure what this means.
>
>
This could be workaround:
~~~
$ git diff
diff --git a/spec/support/unit/rails_application.rb
b/spec/support/unit/rails_application.rb
index b55b12ce..3d5609a1 100644
--- a/spec/support/unit/rails_application.rb
+++ b/spec/support/unit/rails_application.rb
@@ -184,7 +184,7 @@ end
end
def load_environment
- require environment_file_path
+ require environment_file_path.to_s
end
def run_migrations
~~~
IOW it seems like there used to be conversion from Pathname to String somewhere, but it
is not anymore.
Vít
Thank you. After looking at your comment above, it seems that it is indended that
"require" (in bundler)
supports Pathname, once it is modified so:
https://github.com/rubygems/rubygems/pull/6837
This says "**Restore** support for Pathname objects in the replaced require" ,
so it used to support
Pathname, but it got broken at some time, then modified again at this time.
But looks like this got broken again by this commit:
https://github.com/rubygems/rubygems/pull/7056
So may this this is wanted, but I am not sure.
```
diff --git a/lib/bundler/rubygems_integration.rb b/lib/bundler/rubygems_integration.rb
index f420934ceb..59d32e68f3 100644
--- a/lib/bundler/rubygems_integration.rb
+++ b/lib/bundler/rubygems_integration.rb
@@ -244,6 +244,7 @@ def replace_require(specs)
[::Kernel.singleton_class, ::Kernel].each do |kernel_class|
kernel_class.send(:alias_method, :no_warning_require, :require)
kernel_class.send(:define_method, :require) do |name|
+ name = File.path(name)
if message = ::Gem::BUNDLED_GEMS.warning?(name, specs: specs) #
rubocop:disable Style/HashSyntax
warn message, :uplevel => 1
end
```