From 0062ea13e95c3527c9db769faaaf37bfc1e0d8af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juanjo=20Baz=C3=A1n?= Date: Sun, 13 Sep 2015 14:26:09 +0200 Subject: [PATCH] fixes build --- app/helpers/application_helper.rb | 1 + spec/features/votes_spec.rb | 80 +++++++++++++++---------------- 2 files changed, 39 insertions(+), 42 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 57c81b4d6..54eadb947 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -6,6 +6,7 @@ module ApplicationHelper end def home_page? + return false if user_signed_in? # Using path because fullpath yields false negatives since it contains # parameters too request.path == '/' diff --git a/spec/features/votes_spec.rb b/spec/features/votes_spec.rb index a3cf2e43a..33f8f3146 100644 --- a/spec/features/votes_spec.rb +++ b/spec/features/votes_spec.rb @@ -19,41 +19,39 @@ feature 'Votes' do visit root_path - within("#featured-debates") do - within("#debate_#{debate1.id}_votes") do - within(".in-favor") do - expect(page).to have_css("a.voted") - expect(page).to_not have_css("a.no-voted") - end - - within(".against") do - expect(page).to have_css("a.no-voted") - expect(page).to_not have_css("a.voted") - end + within("#debate_#{debate1.id}_votes") do + within(".in-favor") do + expect(page).to have_css("a.voted") + expect(page).to_not have_css("a.no-voted") end - within("#debate_#{debate2.id}_votes") do - within(".in-favor") do - expect(page).to_not have_css("a.voted") - expect(page).to_not have_css("a.no-voted") - end + within(".against") do + expect(page).to have_css("a.no-voted") + expect(page).to_not have_css("a.voted") + end + end - within(".against") do - expect(page).to_not have_css("a.no-voted") - expect(page).to_not have_css("a.voted") - end + within("#debate_#{debate2.id}_votes") do + within(".in-favor") do + expect(page).to_not have_css("a.voted") + expect(page).to_not have_css("a.no-voted") end - within("#debate_#{debate3.id}_votes") do - within(".in-favor") do - expect(page).to have_css("a.no-voted") - expect(page).to_not have_css("a.voted") - end + within(".against") do + expect(page).to_not have_css("a.no-voted") + expect(page).to_not have_css("a.voted") + end + end - within(".against") do - expect(page).to have_css("a.voted") - expect(page).to_not have_css("a.no-voted") - end + within("#debate_#{debate3.id}_votes") do + within(".in-favor") do + expect(page).to have_css("a.no-voted") + expect(page).to_not have_css("a.voted") + end + + within(".against") do + expect(page).to have_css("a.voted") + expect(page).to_not have_css("a.no-voted") end end end @@ -205,21 +203,19 @@ feature 'Votes' do scenario 'Create in featured', :js do visit root_path - within("#featured-debates") do - find('.in-favor a').click + find('.in-favor a').click - within('.in-favor') do - expect(page).to have_content "100%" - expect(page).to have_css("a.voted") - end - - within('.against') do - expect(page).to have_content "0%" - expect(page).to have_css("a.no-voted") - end - - expect(page).to have_content "1 vote" + within('.in-favor') do + expect(page).to have_content "100%" + expect(page).to have_css("a.voted") end + + within('.against') do + expect(page).to have_content "0%" + expect(page).to have_css("a.no-voted") + end + + expect(page).to have_content "1 vote" expect(current_path).to eq(root_path) end