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



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

def determine_default_mailer(name)
  name.sub(/Test$/, '').constantize
rescue NameError
  raise NonInferrableMailerError.new(name)
end

#mailer_classObject



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

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

#tests(mailer) ⇒ Object



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

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