Skip to content
Snippets Groups Projects
Commit 9a35007c authored by Kerdo Kurs's avatar Kerdo Kurs
Browse files

finish BDD #18

parent d339ea9c
No related branches found
No related tags found
1 merge request!13Resolve "FR-08: Create Property Advertisement" and "FR-07: View Properties (Unauthenticated)"
......@@ -27,3 +27,9 @@ Feature: FR-08 Property Advertisement Creation
When I click submit
Then I should see error messages
And I should still see the new property advertisement form
Scenario: Unauthenticated user should not be able to create an advertisement
Given I am not logged in
And I would like to create a new property advertisement
Then I should not see a link to create a new property advertisement
And I should be redirected back to home page when I try to access the link
......@@ -113,6 +113,26 @@ defmodule AdvertisementCreationContext do
{:ok, state}
end
given_ ~r/^I am not logged in$/, fn state ->
navigate_to("/logout")
{:ok, state}
end
and_ ~r/^I would like to create a new property advertisement$/, fn state ->
navigate_to("/")
{:ok, state}
end
then_ ~r/^I should not see a link to create a new property advertisement$/, fn state ->
assert not visible_in_page? ~r/Add a new property listing/
{:ok, state}
end
and_ ~r/^I should be redirected back to home page when I try to access the link$/, fn state ->
assert current_path() == "/"
{:ok, state}
end
defp setup_session(email, password) do
navigate_to("/login")
fill_field({:id, "email"}, email)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment