Add more route helper integration specs

This commit is contained in:
Andrew Haines 2013-07-14 16:03:16 +01:00
parent 7c14385ee6
commit 3b092b2248
3 changed files with 22 additions and 0 deletions

View File

@ -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>

View File

@ -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

View File

@ -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