Skip to content

Commit

Permalink
_path helpers are no longer available in mailers
Browse files Browse the repository at this point in the history
  • Loading branch information
seanlinsley committed Jul 4, 2016
1 parent 1744161 commit 88963fc
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 14 deletions.
14 changes: 8 additions & 6 deletions spec/dummy/app/views/posts/_post.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,16 @@
<dt>Helpers from the controller:</dt>
<dd id="goodnight_moon"><%= post.goodnight_moon %></dd>

<dt>Path with decorator:</dt>
<dd id="path_with_decorator"><%= post_path(post) %></dd>
<% unless defined? mailer %>
<dt>Path with decorator:</dt>
<dd id="path_with_decorator"><%= post_url(post) %></dd>

<dt>Path with model:</dt>
<dd id="path_with_model"><%= post.path_with_model %></dd>
<dt>Path with model:</dt>
<dd id="path_with_model"><%= post.path_with_model %></dd>

<dt>Path with id:</dt>
<dd id="path_with_id"><%= post.path_with_id %></dd>
<dt>Path with id:</dt>
<dd id="path_with_id"><%= post.path_with_id %></dd>
<% end %>

<dt>URL with decorator:</dt>
<dd id="url_with_decorator"><%= post_url(post) %></dd>
Expand Down
19 changes: 11 additions & 8 deletions spec/integration/integration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,19 @@
expect(page).to have_text("Goodnight, moon!").in("#goodnight_moon")
end

it "can be passed to path helpers" do
expect(page).to have_text("/en/posts/1").in("#path_with_decorator")
end
# _path helpers aren't available in mailers
if type == :view
it "can be passed to path helpers" do
expect(page).to have_text("/en/posts/1").in("#path_with_decorator")
end

it "can use path helpers with a model" do
expect(page).to have_text("/en/posts/1").in("#path_with_model")
end
it "can use path helpers with a model" do
expect(page).to have_text("/en/posts/1").in("#path_with_model")
end

it "can use path helpers with an id" do
expect(page).to have_text("/en/posts/1").in("#path_with_id")
it "can use path helpers with an id" do
expect(page).to have_text("/en/posts/1").in("#path_with_id")
end
end

it "can be passed to url helpers" do
Expand Down

0 comments on commit 88963fc

Please sign in to comment.