From 8a642d3c967f4d7aa50d36edbd1cc394c6f16b20 Mon Sep 17 00:00:00 2001 From: rgarcia Date: Tue, 28 Jul 2015 20:53:09 +0200 Subject: [PATCH] fixes specs [#47] --- spec/features/votes_spec.rb | 38 +++++++++++++++++++++++++++++++------ 1 file changed, 32 insertions(+), 6 deletions(-) diff --git a/spec/features/votes_spec.rb b/spec/features/votes_spec.rb index cec794376..d1aabd84a 100644 --- a/spec/features/votes_spec.rb +++ b/spec/features/votes_spec.rb @@ -28,21 +28,47 @@ feature 'Votes' do end end - scenario 'Create' do + scenario 'Create', :js do find('#in_favor a').click - expect(page).to have_content "Thanks for voting." + + within('#in_favor') do + expect(page).to have_content "100%" + end + + within('#against') do + expect(page).to have_content "0%" + end + + expect(page).to have_content "1 vote" end - scenario 'Update' do + scenario 'Update', :js do find('#in_favor a').click find('#against a').click - expect(page).to have_content "Thanks for voting." + + within('#in_favor') do + expect(page).to have_content "0%" + end + + within('#against') do + expect(page).to have_content "100%" + end + + expect(page).to have_content "1 vote" end - scenario 'Trying to vote multiple times' do + scenario 'Trying to vote multiple times', :js do find('#in_favor a').click find('#in_favor a').click - expect(page).to have_content "Your vote is already registered." + + within('#in_favor') do + expect(page).to have_content "100%" + end + + within('#against') do + expect(page).to have_content "0%" + end + expect(page).to have_content "1 vote" end