require'rspec/core/rake_task' I don't know what file I'm loading

Asked 2 years ago, Updated 2 years ago, 372 views

In order for rake to run RSpec automatically, it was necessary to load require'rspec/core/rake_task', but when I went to see rspec's github, there was no such path.
I'd like to solve this problem because it's muddled and disgusting, but I couldn't get to the answer, so I came up with a question.
I would appreciate it if someone could tell me.

ruby rspec rake

2022-09-30 21:58

1 Answers

require I think it would be better to use the method to get the path to be loaded.
For example, if require'rspec/core/rake_task' reads the path:

$LOAD_PATH.resolve_feature_path('rspec/core/rake_task')
# =>[:rb, "/var/app/vendor/bundle/ruby/3.1.0/gems/rspec-core-3.11.0/lib/rspec/core/rake_task.rb" ]

See also

$LOAD_PATH

Load path for searching Ruby scripts and extension libraries used by Kernel #load and Kernel #require.Aliased to $: and $-I.Has a singleton method $LOAD_PATH.resolve_feature_path(feature) that returns [:rb or:so, what the nature] https://docs.ruby-lang.org/en/3.1/globals_rdoc.html#label-Pre-defined+global+variables


2022-09-30 21:58

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.