Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Potentially-failing integration test for #have_sent_email

  • Loading branch information...
commit 68ac6ae87fd798e85866aadff195535dabbc8239 1 parent 0142d8b
@mike-burns mike-burns authored
View
8 test/rails2_root/app/models/flea.rb
@@ -1,3 +1,11 @@
class Flea < ActiveRecord::Base
has_and_belongs_to_many :dogs
+
+ after_create :send_notification
+
+ private
+
+ def send_notification
+ Notifier.deliver_the_email
+ end
end
View
8 test/rails2_root/app/models/notifier.rb
@@ -0,0 +1,8 @@
+class Notifier < ActionMailer::Base
+ def the_email
+ from "do-not-reply@example.com"
+ recipients "myself@me.com"
+ subject "This is spam"
+ body :body => "Every email is spam."
+ end
+end
View
1  test/rails2_root/app/views/notifier/the_email.html.erb
@@ -0,0 +1 @@
+<%= @body %>
View
2  test/unit/flea_test.rb
@@ -2,5 +2,7 @@
class FleaTest < ActiveSupport::TestCase
should_have_and_belong_to_many :dogs
+
+ should have_sent_email.to('myself@me.com')
end
Please sign in to comment.
Something went wrong with that request. Please try again.