Class: Hanami::Minitest::Generators::Mailer Private

Inherits:
Object
  • Object
show all
Defined in:
lib/hanami/minitest/generators/mailer.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Since:

  • 2.0.0

Instance Method Summary collapse

Constructor Details

#initialize(fs:, inflector:) ⇒ Mailer

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Mailer.

Since:

  • 2.0.0



10
11
12
13
# File 'lib/hanami/minitest/generators/mailer.rb', line 10

def initialize(fs:, inflector:)
  @fs = fs
  @inflector = inflector
end

Instance Method Details

#call(key:, namespace:, base_path:) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 2.0.0



15
16
17
18
19
20
21
# File 'lib/hanami/minitest/generators/mailer.rb', line 15

def call(key:, namespace:, base_path:)
  ruby_class_file = mailer_ruby_class_file(key:, namespace:, base_path:)
  test_file_path = ruby_class_file.path.gsub(/\.rb$/, "_test.rb")
  mailer_class_name = ruby_class_file.fully_qualified_name

  fs.write(test_file_path, test_content(mailer_class_name))
end