Module: ActionMailer::TestCase::Behavior::ClassMethods

Defined in:
actionmailer/lib/action_mailer/test_case.rb

Instance Method Summary collapse

Instance Method Details

#determine_default_mailer(name) ⇒ Object



45
46
47
48
49
50
51
# File 'actionmailer/lib/action_mailer/test_case.rb', line 45

def determine_default_mailer(name)
  mailer = determine_constant_from_test_name(name) do |constant|
    Class === constant && constant < ActionMailer::Base
  end
  raise NonInferrableMailerError.new(name) if mailer.nil?
  mailer
end

#mailer_classObject



37
38
39
40
41
42
43
# File 'actionmailer/lib/action_mailer/test_case.rb', line 37

def mailer_class
  if mailer = self._mailer_class
    mailer
  else
    tests determine_default_mailer(name)
  end
end

#tests(mailer) ⇒ Object



26
27
28
29
30
31
32
33
34
35
# File 'actionmailer/lib/action_mailer/test_case.rb', line 26

def tests(mailer)
  case mailer
  when String, Symbol
    self._mailer_class = mailer.to_s.camelize.constantize
  when Module
    self._mailer_class = mailer
  else
    raise NonInferrableMailerError.new(mailer)
  end
end