aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/generators/test_unit/mailer/templates
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2009-06-25 12:57:58 +0200
committerJosé Valim <jose.valim@gmail.com>2009-06-25 12:57:58 +0200
commit6e6c0117b30226f031771acb9715318987067f51 (patch)
tree0561577a33b94e0245ee88ef56988eb8b638b4a1 /railties/lib/generators/test_unit/mailer/templates
parented33c29a4e2a07c2a738ec13775c5cc0d7867b50 (diff)
downloadrails-6e6c0117b30226f031771acb9715318987067f51.tar.gz
rails-6e6c0117b30226f031771acb9715318987067f51.tar.bz2
rails-6e6c0117b30226f031771acb9715318987067f51.zip
Added Mailer generaator template engine and test framework agnostic.
Diffstat (limited to 'railties/lib/generators/test_unit/mailer/templates')
-rw-r--r--railties/lib/generators/test_unit/mailer/templates/fixture3
-rw-r--r--railties/lib/generators/test_unit/mailer/templates/unit_test.rb20
2 files changed, 23 insertions, 0 deletions
diff --git a/railties/lib/generators/test_unit/mailer/templates/fixture b/railties/lib/generators/test_unit/mailer/templates/fixture
new file mode 100644
index 0000000000..cda2cd24fe
--- /dev/null
+++ b/railties/lib/generators/test_unit/mailer/templates/fixture
@@ -0,0 +1,3 @@
+<%= class_name %>#<%= @action %>
+
+Find me in <%= @path %>
diff --git a/railties/lib/generators/test_unit/mailer/templates/unit_test.rb b/railties/lib/generators/test_unit/mailer/templates/unit_test.rb
new file mode 100644
index 0000000000..4de94076e9
--- /dev/null
+++ b/railties/lib/generators/test_unit/mailer/templates/unit_test.rb
@@ -0,0 +1,20 @@
+require 'test_helper'
+
+class <%= class_name %>Test < ActionMailer::TestCase
+<% for action in actions -%>
+ test "<%= action %>" do
+ @expected.subject = '<%= class_name %>#<%= action %>'
+ @expected.body = read_fixture('<%= action %>')
+ @expected.date = Time.now
+
+ assert_equal @expected.encoded, <%= class_name %>.create_<%= action %>(@expected.date).encoded
+ end
+
+<% end -%>
+<% if actions.blank? -%>
+ # replace this with your real tests
+ test "the truth" do
+ assert true
+ end
+<% end -%>
+end