diff options
author | José Valim and Mikel Lindsaar <pair@programming.com> | 2010-01-26 01:06:48 +0100 |
---|---|---|
committer | José Valim and Mikel Lindsaar <pair@programming.com> | 2010-01-26 01:09:08 +0100 |
commit | 1b3cb54ebae685d4db9eefc99ce68b36d5641751 (patch) | |
tree | 5f8eed9c31a9cdeeb8982ecaab9463259eecd3be /railties/test | |
parent | f14390091c40149dcd0982ada097be5bcbb37003 (diff) | |
download | rails-1b3cb54ebae685d4db9eefc99ce68b36d5641751.tar.gz rails-1b3cb54ebae685d4db9eefc99ce68b36d5641751.tar.bz2 rails-1b3cb54ebae685d4db9eefc99ce68b36d5641751.zip |
More work on generated mailer templates.
Diffstat (limited to 'railties/test')
-rw-r--r-- | railties/test/generators/mailer_generator_test.rb | 11 | ||||
-rw-r--r-- | railties/test/generators/named_base_test.rb | 8 |
2 files changed, 13 insertions, 6 deletions
diff --git a/railties/test/generators/mailer_generator_test.rb b/railties/test/generators/mailer_generator_test.rb index 0203eb314c..99ce53323e 100644 --- a/railties/test/generators/mailer_generator_test.rb +++ b/railties/test/generators/mailer_generator_test.rb @@ -6,11 +6,10 @@ class MailerGeneratorTest < Rails::Generators::TestCase arguments %w(notifier foo bar) def test_mailer_skeleton_is_created - Rails.stubs(:application).returns(Object.new) run_generator assert_file "app/mailers/notifier.rb" do |mailer| assert_match /class Notifier < ActionMailer::Base/, mailer - assert_match /delivers_from "mail@object.com"/, mailer + assert_match /delivers_from "from@example.com"/, mailer end end @@ -36,12 +35,12 @@ class MailerGeneratorTest < Rails::Generators::TestCase def test_invokes_default_template_engine run_generator - assert_file "app/views/notifier/foo.erb" do |view| + assert_file "app/views/notifier/foo.text.erb" do |view| assert_match /app\/views\/notifier\/foo/, view assert_match /<%= @greeting %>/, view end - assert_file "app/views/notifier/bar.erb" do |view| + assert_file "app/views/notifier/bar.text.erb" do |view| assert_match /app\/views\/notifier\/bar/, view assert_match /<%= @greeting %>/, view end @@ -62,12 +61,12 @@ class MailerGeneratorTest < Rails::Generators::TestCase assert_file "app/mailers/notifier.rb" do |mailer| assert_instance_method :foo, mailer do |foo| - assert_match /mail\(:to => ""\)/, foo + assert_match /mail\(:to => "to@example.com"\)/, foo assert_match /@greeting = "Hi"/, foo end assert_instance_method :bar, mailer do |bar| - assert_match /mail\(:to => ""\)/, bar + assert_match /mail\(:to => "to@example.com"\)/, bar assert_match /@greeting = "Hi"/, bar end end diff --git a/railties/test/generators/named_base_test.rb b/railties/test/generators/named_base_test.rb index 7514bc32bd..f327fb1282 100644 --- a/railties/test/generators/named_base_test.rb +++ b/railties/test/generators/named_base_test.rb @@ -67,6 +67,14 @@ class NamedBaseTest < Rails::Generators::TestCase assert_name g, 'admin.foos', :controller_i18n_scope end + def test_application_name + g = generator ['Admin::Foo'] + Rails.stubs(:application).returns(Object.new) + assert_name g, "object", :application_name + Rails.stubs(:application).returns(nil) + assert_name g, "application", :application_name + end + protected def assert_name(generator, value, method) |