_path helpers are no longer available in mailers
https://github.com/rails/rails/pull/15840
This commit is contained in:
parent
1744161075
commit
1e52e791ff
|
@ -20,14 +20,16 @@
|
||||||
<dt>Helpers from the controller:</dt>
|
<dt>Helpers from the controller:</dt>
|
||||||
<dd id="goodnight_moon"><%= post.goodnight_moon %></dd>
|
<dd id="goodnight_moon"><%= post.goodnight_moon %></dd>
|
||||||
|
|
||||||
|
<% unless defined? mailer %>
|
||||||
<dt>Path with decorator:</dt>
|
<dt>Path with decorator:</dt>
|
||||||
<dd id="path_with_decorator"><%= post_path(post) %></dd>
|
<dd id="path_with_decorator"><%= post_url(post) %></dd>
|
||||||
|
|
||||||
<dt>Path with model:</dt>
|
<dt>Path with model:</dt>
|
||||||
<dd id="path_with_model"><%= post.path_with_model %></dd>
|
<dd id="path_with_model"><%= post.path_with_model %></dd>
|
||||||
|
|
||||||
<dt>Path with id:</dt>
|
<dt>Path with id:</dt>
|
||||||
<dd id="path_with_id"><%= post.path_with_id %></dd>
|
<dd id="path_with_id"><%= post.path_with_id %></dd>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<dt>URL with decorator:</dt>
|
<dt>URL with decorator:</dt>
|
||||||
<dd id="url_with_decorator"><%= post_url(post) %></dd>
|
<dd id="url_with_decorator"><%= post_url(post) %></dd>
|
||||||
|
|
|
@ -10,14 +10,6 @@ describe PostMailer do
|
||||||
expect(email_body).to have_content "Today"
|
expect(email_body).to have_content "Today"
|
||||||
end
|
end
|
||||||
|
|
||||||
it "can use path helpers with a model" do
|
|
||||||
expect(email_body).to have_css "#path_with_model", text: "/en/posts/#{post.id}"
|
|
||||||
end
|
|
||||||
|
|
||||||
it "can use path helpers with an id" do
|
|
||||||
expect(email_body).to have_css "#path_with_id", text: "/en/posts/#{post.id}"
|
|
||||||
end
|
|
||||||
|
|
||||||
it "can use url helpers with a model" do
|
it "can use url helpers with a model" do
|
||||||
expect(email_body).to have_css "#url_with_model", text: "http://www.example.com:12345/en/posts/#{post.id}"
|
expect(email_body).to have_css "#url_with_model", text: "http://www.example.com:12345/en/posts/#{post.id}"
|
||||||
end
|
end
|
||||||
|
|
|
@ -38,6 +38,8 @@ app.start_server do
|
||||||
expect(page).to have_text("Goodnight, moon!").in("#goodnight_moon")
|
expect(page).to have_text("Goodnight, moon!").in("#goodnight_moon")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# _path helpers aren't available in mailers
|
||||||
|
if type == :view
|
||||||
it "can be passed to path helpers" do
|
it "can be passed to path helpers" do
|
||||||
expect(page).to have_text("/en/posts/1").in("#path_with_decorator")
|
expect(page).to have_text("/en/posts/1").in("#path_with_decorator")
|
||||||
end
|
end
|
||||||
|
@ -49,6 +51,7 @@ app.start_server do
|
||||||
it "can use path helpers with an id" do
|
it "can use path helpers with an id" do
|
||||||
expect(page).to have_text("/en/posts/1").in("#path_with_id")
|
expect(page).to have_text("/en/posts/1").in("#path_with_id")
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
it "can be passed to url helpers" do
|
it "can be passed to url helpers" do
|
||||||
expect(page).to have_text("http://www.example.com:12345/en/posts/1").in("#url_with_decorator")
|
expect(page).to have_text("http://www.example.com:12345/en/posts/1").in("#url_with_decorator")
|
||||||
|
|
Loading…
Reference in New Issue