Skip to content

Commit

Permalink
Use zeitwerk/bundler friendly namespaced gem 'require'
Browse files Browse the repository at this point in the history
There is no need create a file called lib/my-gem.rb.
Bundler will automatically treat this as a namespace due to the hyphen, so it
will try a my-gem require first and then fallback on my/gem.

See:
https://github.com/rubygems/rubygems/blob/a223274e4627e8a76112415c0e38f8a45a42f97e/bundler/lib/bundler/runtime.rb#L72-L73

Because we're moving towards zeitwerk, ruby files should be named based on their
namespace/class names.

1) Moving / renaming based on a namespaced gem name works automatically with
bundler.
2) Zeitwerk knows to ignore this file, so we don't need to.
  • Loading branch information
jrafanie committed Apr 20, 2023
1 parent 702dd87 commit d883ad5
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 1 deletion.
File renamed without changes.
2 changes: 1 addition & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
Dir[Rails.root.join("spec/shared/**/*.rb")].each { |f| require f }
Dir[File.join(__dir__, "support/**/*.rb")].each { |f| require f }

require "manageiq-consumption"
require "manageiq/consumption"

0 comments on commit d883ad5

Please sign in to comment.