add feature test for debates friendly urls

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

View File

@@ -61,6 +61,28 @@ feature 'Debates' do
expect(link_text).to include(debates_path order: :hot_score, page: 1)
end
context "Show" do
scenario 'When path matches the friendly url' do
debate = create(:debate)
right_path = debate_path(debate)
visit right_path
expect(current_path).to eq(right_path)
end
scenario 'When path does not match the friendly url' do
debate = create(:debate)
right_path = debate_path(debate)
old_path = "#{debates_path}/#{debate.id}-something-else"
visit old_path
expect(current_path).to_not eq(old_path)
expect(current_path).to eq(right_path)
end
end
scenario 'Create' do
author = create(:user)
login_as(author)