Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix zeitwerk loader #105

Merged
merged 3 commits into from
Dec 16, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/cloudflare-rails.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require 'cloudflare_rails'
4 changes: 3 additions & 1 deletion lib/cloudflare_rails.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
require 'zeitwerk'
modosc marked this conversation as resolved.
Show resolved Hide resolved
loader = Zeitwerk::Loader.for_gem
loader.ignore("#{__dir__}/cloudflare-rails.rb")
loader.setup
loader.eager_load

module CloudflareRails
end

loader.eager_load
8 changes: 1 addition & 7 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
# copied from https://codingdaily.wordpress.com/2011/01/14/test-a-gem-with-the-rails-3-stack/
$LOAD_PATH.unshift File.expand_path('../lib', __dir__)

modosc marked this conversation as resolved.
Show resolved Hide resolved
ENV['RAILS_ENV'] ||= 'test'

require 'bundler/setup'
Bundler.setup

modosc marked this conversation as resolved.
Show resolved Hide resolved
require 'rubygems'
require 'pry'

# Only the parts of rails we want to use
Expand All @@ -24,7 +18,7 @@
require 'rack/attack'
end

require 'cloudflare_rails'
require 'cloudflare-rails'

if ENV['RACK_ATTACK'] == 'last'
# pull in rack/attack last to make sure patches work with it
Expand Down
Loading