add feature test for management proposals friendly urls

This commit is contained in:
Julian Herrero
2016-03-02 16:01:57 +01:00
parent 80edc4f613
commit c44745e0b4

View File

@@ -56,6 +56,34 @@ feature 'Proposals' do
end end
end end
context "Show" do
scenario 'When path matches the friendly url' do
proposal = create(:proposal)
user = create(:user, :level_two)
login_managed_user(user)
right_path = management_proposal_path(proposal)
visit right_path
expect(current_path).to eq(right_path)
end
scenario 'When path does not match the friendly url' do
proposal = create(:proposal)
user = create(:user, :level_two)
login_managed_user(user)
right_path = management_proposal_path(proposal)
old_path = "#{management_proposals_path}/#{proposal.id}-something-else"
visit old_path
expect(current_path).to_not eq(old_path)
expect(current_path).to eq(right_path)
end
end
scenario "Searching" do scenario "Searching" do
proposal1 = create(:proposal, title: "Show me what you got") proposal1 = create(:proposal, title: "Show me what you got")
proposal2 = create(:proposal, title: "Get Schwifty") proposal2 = create(:proposal, title: "Get Schwifty")