mirror of
https://github.com/drapergem/draper
synced 2023-03-27 23:21:17 -04:00
Add more route helper integration specs
This commit is contained in:
parent
7c14385ee6
commit
3b092b2248
3 changed files with 22 additions and 0 deletions
|
@ -20,12 +20,18 @@
|
|||
<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>
|
||||
|
||||
<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>URL with decorator:</dt>
|
||||
<dd id="url_with_decorator"><%= post_url(post) %></dd>
|
||||
|
||||
<dt>URL with model:</dt>
|
||||
<dd id="url_with_model"><%= post.url_with_model %></dd>
|
||||
|
||||
|
|
|
@ -16,6 +16,10 @@ describe PostDecorator do
|
|||
expect(decorator.hello_world).to eq "Hello, world!"
|
||||
end
|
||||
|
||||
it "can be passed to path helpers" do
|
||||
expect(helpers.post_path(decorator)).to eq "/en/posts/#{object.id}"
|
||||
end
|
||||
|
||||
it "can use path helpers with its model" do
|
||||
expect(decorator.path_with_model).to eq "/en/posts/#{object.id}"
|
||||
end
|
||||
|
@ -24,6 +28,10 @@ describe PostDecorator do
|
|||
expect(decorator.path_with_id).to eq "/en/posts/#{object.id}"
|
||||
end
|
||||
|
||||
it "can be passed to url helpers" do
|
||||
expect(helpers.post_url(decorator)).to eq "http://www.example.com:12345/en/posts/#{object.id}"
|
||||
end
|
||||
|
||||
it "can use url helpers with its model" do
|
||||
expect(decorator.url_with_model).to eq "http://www.example.com:12345/en/posts/#{object.id}"
|
||||
end
|
||||
|
|
|
@ -38,6 +38,10 @@ app.start_server do
|
|||
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
|
||||
|
||||
it "can use path helpers with a model" do
|
||||
expect(page).to have_text("/en/posts/1").in("#path_with_model")
|
||||
end
|
||||
|
@ -46,6 +50,10 @@ app.start_server do
|
|||
expect(page).to have_text("/en/posts/1").in("#path_with_id")
|
||||
end
|
||||
|
||||
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")
|
||||
end
|
||||
|
||||
it "can use url helpers with a model" do
|
||||
expect(page).to have_text("http://www.example.com:12345/en/posts/1").in("#url_with_model")
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue