Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of git@github.com:rails/rails
- Loading branch information
Showing
267 changed files
with
10,347 additions
and
5,055 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Inside |
1 change: 1 addition & 0 deletions
1
actionmailer/test/fixtures/explicit_layout_mailer/logout.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
You logged out |
1 change: 1 addition & 0 deletions
1
actionmailer/test/fixtures/explicit_layout_mailer/signup.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
We do not spam |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Hello from layout <%= yield %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Spammer layout <%= yield %> |
10 changes: 10 additions & 0 deletions
10
actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.text.html.erb~
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<html> | ||
<body> | ||
HTML formatted message to <strong><%= @recipient %></strong>. | ||
</body> | ||
</html> | ||
<html> | ||
<body> | ||
HTML formatted message to <strong><%= @recipient %></strong>. | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
require 'abstract_unit' | ||
|
||
class AutoLayoutMailer < ActionMailer::Base | ||
def hello(recipient) | ||
recipients recipient | ||
subject "You have a mail" | ||
from "tester@example.com" | ||
end | ||
|
||
def spam(recipient) | ||
recipients recipient | ||
subject "You have a mail" | ||
from "tester@example.com" | ||
body render(:inline => "Hello, <%= @world %>", :layout => 'spam', :body => { :world => "Earth" }) | ||
end | ||
|
||
def nolayout(recipient) | ||
recipients recipient | ||
subject "You have a mail" | ||
from "tester@example.com" | ||
body render(:inline => "Hello, <%= @world %>", :layout => false, :body => { :world => "Earth" }) | ||
end | ||
end | ||
|
||
class ExplicitLayoutMailer < ActionMailer::Base | ||
layout 'spam', :except => [:logout] | ||
|
||
def signup(recipient) | ||
recipients recipient | ||
subject "You have a mail" | ||
from "tester@example.com" | ||
end | ||
|
||
def logout(recipient) | ||
recipients recipient | ||
subject "You have a mail" | ||
from "tester@example.com" | ||
end | ||
end | ||
|
||
class LayoutMailerTest < Test::Unit::TestCase | ||
def setup | ||
set_delivery_method :test | ||
ActionMailer::Base.perform_deliveries = true | ||
ActionMailer::Base.deliveries = [] | ||
|
||
@recipient = 'test@localhost' | ||
end | ||
|
||
def teardown | ||
restore_delivery_method | ||
end | ||
|
||
def test_should_pickup_default_layout | ||
mail = AutoLayoutMailer.create_hello(@recipient) | ||
assert_equal "Hello from layout Inside", mail.body.strip | ||
end | ||
|
||
def test_should_pickup_layout_given_to_render | ||
mail = AutoLayoutMailer.create_spam(@recipient) | ||
assert_equal "Spammer layout Hello, Earth", mail.body.strip | ||
end | ||
|
||
def test_should_respect_layout_false | ||
mail = AutoLayoutMailer.create_nolayout(@recipient) | ||
assert_equal "Hello, Earth", mail.body.strip | ||
end | ||
|
||
def test_explicit_class_layout | ||
mail = ExplicitLayoutMailer.create_signup(@recipient) | ||
assert_equal "Spammer layout We do not spam", mail.body.strip | ||
end | ||
|
||
def test_explicit_layout_exceptions | ||
mail = ExplicitLayoutMailer.create_logout(@recipient) | ||
assert_equal "You logged out", mail.body.strip | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.