Skip to content

Instantly share code, notes, and snippets.

@soulcutter
Created June 18, 2025 01:56
Show Gist options
  • Save soulcutter/b0dd8ecdbb6f45551d6c961b460dbb8a to your computer and use it in GitHub Desktop.
Save soulcutter/b0dd8ecdbb6f45551d6c961b460dbb8a to your computer and use it in GitHub Desktop.
Testing a Railtie initialize block
specify "the railtie after_initialize executes" do
YourRailtie.config.after_initialize.each do |initializer, _kwargs|
# initializer: #<Proc:0x00000001095aa6e0 /Projects/yawl/lib/railties/your_railtie.rb:10>
# _kwargs: {:yield=>true}
next unless initializer.to_s.include?('railties/your_railtie') # some unique path to the railtie classs
initializer.call
@called = true
end
expect(@called).to be_truthy
# assert the behavior of the initializer itself
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment