module Rails::Generators::Testing::Assertions
def assert_initializer(name, *contents, &block)
assert_match(/SandboxEmailInterceptor/, initializer)
assert_initializer "mail_interceptors.rb" do |initializer|
Finally, when a block is given, it yields the file content:
assert_initializer "mail_interceptors.rb", /SandboxEmailInterceptor/
file with the given string:
regular expression matches the given file content. If it's a string, it compares the
You can also give extra arguments. If the argument is a regexp, it will check if the
assert_initializer "mail_interceptors.rb"
to the `config/initializers/` directory.
Asserts a given initializer exists. You need to supply a path relative
def assert_initializer(name, *contents, &block) assert_file("config/initializers/#{name}", *contents, &block) end