Created
June 18, 2025 01:56
-
-
Save soulcutter/b0dd8ecdbb6f45551d6c961b460dbb8a to your computer and use it in GitHub Desktop.
Testing a Railtie initialize block
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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