Skip to content

Instantly share code, notes, and snippets.

@josevalim
Created January 25, 2010 22:20
Show Gist options
  • Select an option

  • Save josevalim/286328 to your computer and use it in GitHub Desktop.

Select an option

Save josevalim/286328 to your computer and use it in GitHub Desktop.
class Notifier < ActionMailer::Base
delivers_from "[email protected]"
# Subject can be set in your I18n file at config/locales/en.yml
# with the following lookup:
#
# en.actionmailer.notifier.foo.subject
#
def foo
@greeting = "Hi"
mail(:to => "")
end
# Subject can be set in your I18n file at config/locales/en.yml
# with the following lookup:
#
# en.actionmailer.notifier.bar.subject
#
def bar
@greeting = "Hi"
mail(:to => "")
end
end
require 'test_helper'
class NotifierTest < ActionMailer::TestCase
test "foo" do
@actual = Notifier.foo
@expected.subject = "Foo"
@expected.from = "[email protected]"
@expected.body = read_fixture("foo")
@expected.date = Time.now
assert_difference "Notifier.deliveries.size" do
@actual.deliver
end
assert_equal @expected.encoded, @actual.encoded
end
test "bar" do
@actual = Notifier.bar
@expected.subject = "Bar"
@expected.from = "[email protected]"
@expected.body = read_fixture("bar")
@expected.date = Time.now
assert_difference "Notifier.deliveries.size" do
@actual.deliver
end
assert_equal @expected.encoded, @actual.encoded
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment