mardi 26 mai 2015

Why Rails instance method can be used as class method in rspec

I found a snippet in an article about sending mails in a Rails application:

class ExampleMailerPreview < ActionMailer::Preview
  def sample_mail_preview
    ExampleMailer.sample_email(User.first)
  end
end

in this link: http://ift.tt/11PqLfz.

I do not know why the method: sample_email(), which in my mind should be an instance method, can be accessed like class method here as ExampleMailer.sample_email(). Can anyone explain?

Aucun commentaire:

Enregistrer un commentaire