diff --git a/spec/features/tags/budget_investments_spec.rb b/spec/features/tags/budget_investments_spec.rb index 4c978c740..73655ebb2 100644 --- a/spec/features/tags/budget_investments_spec.rb +++ b/spec/features/tags/budget_investments_spec.rb @@ -7,44 +7,18 @@ feature 'Tags' do let(:group) { create(:budget_group, name: "Health", budget: budget) } let!(:heading) { create(:budget_heading, name: "More hospitals", group: group) } - scenario 'Index' do + scenario 'Does not show on index' do earth = create(:budget_investment, heading: heading, tag_list: 'Medio Ambiente') money = create(:budget_investment, heading: heading, tag_list: 'Economía') visit budget_investments_path(budget, heading_id: heading.id) within "#budget_investment_#{earth.id}" do - expect(page).to have_content "Medio Ambiente" + expect(page).to_not have_content "Medio Ambiente" end within "#budget_investment_#{money.id}" do - expect(page).to have_content "Economía" - end - end - - scenario 'Index shows 3 tags with no plus link' do - tag_list = ["Medio Ambiente", "Corrupción", "Fiestas populares"] - create :budget_investment, heading: heading, tag_list: tag_list - - visit budget_investments_path(budget, heading_id: heading.id) - - within('.budget-investment .tags') do - tag_list.each do |tag| - expect(page).to have_content tag - end - expect(page).not_to have_content '+' - end - end - - scenario 'Index shows up to 5 tags per proposal' do - create_featured_proposals - tag_list = ["Hacienda", "Economía", "Medio Ambiente", "Corrupción", "Fiestas populares", "Prensa"] - create :budget_investment, heading: heading, tag_list: tag_list - - visit budget_investments_path(budget, heading_id: heading.id) - - within('.budget-investment .tags') do - expect(page).to have_content '1+' + expect(page).to_not have_content "Economía" end end @@ -140,21 +114,18 @@ feature 'Tags' do end context "Filter" do - - scenario "From index" do - + scenario "Does not from index" do investment1 = create(:budget_investment, heading: heading, tag_list: 'Education') investment2 = create(:budget_investment, heading: heading, tag_list: 'Health') visit budget_investments_path(budget, heading_id: heading.id) within "#budget_investment_#{investment1.id}" do - click_link "Education" + expect(page).to_not have_link('Education') end - within("#budget-investments") do - expect(page).to have_css('.budget-investment', count: 1) - expect(page).to have_content(investment1.title) + within "#budget_investment_#{investment2.id}" do + expect(page).to_not have_link('Health') end end diff --git a/spec/features/tags/debates_spec.rb b/spec/features/tags/debates_spec.rb index 6bfca4772..522abf86d 100644 --- a/spec/features/tags/debates_spec.rb +++ b/spec/features/tags/debates_spec.rb @@ -2,43 +2,18 @@ require 'rails_helper' feature 'Tags' do - scenario 'Index' do + scenario 'Does not show on index' do earth = create(:debate, tag_list: 'Medio Ambiente') money = create(:debate, tag_list: 'Economía') visit debates_path within "#debate_#{earth.id}" do - expect(page).to have_content "Medio Ambiente" + expect(page).to_not have_content "Medio Ambiente" end within "#debate_#{money.id}" do - expect(page).to have_content "Economía" - end - end - - scenario 'Index shows up to 5 tags per proposal' do - tag_list = ["Hacienda", "Economía", "Medio Ambiente", "Corrupción", "Fiestas populares", "Prensa"] - create :debate, tag_list: tag_list - - visit debates_path - - within('.debate .tags') do - expect(page).to have_content '1+' - end - end - - scenario 'Index shows 3 tags with no plus link' do - tag_list = ["Medio Ambiente", "Corrupción", "Fiestas populares"] - create :debate, tag_list: tag_list - - visit debates_path - - within('.debate .tags') do - tag_list.each do |tag| - expect(page).to have_content tag - end - expect(page).not_to have_content '+' + expect(page).to_not have_content "Economía" end end @@ -151,19 +126,18 @@ feature 'Tags' do context "Filter" do - scenario "From index" do + scenario "Does not from index" do debate1 = create(:debate, tag_list: 'Education') debate2 = create(:debate, tag_list: 'Health') visit debates_path within "#debate_#{debate1.id}" do - click_link "Education" + expect(page).to_not have_link('Education') end - within("#debates") do - expect(page).to have_css('.debate', count: 1) - expect(page).to have_content(debate1.title) + within "#debate_#{debate2.id}" do + expect(page).to_not have_link('Health') end end diff --git a/spec/features/tags/proposals_spec.rb b/spec/features/tags/proposals_spec.rb index dbab6a95f..f3d00e546 100644 --- a/spec/features/tags/proposals_spec.rb +++ b/spec/features/tags/proposals_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' feature 'Tags' do - scenario 'Index' do + scenario 'Does not show on index' do create_featured_proposals earth = create(:proposal, tag_list: 'Medio Ambiente') money = create(:proposal, tag_list: 'Economía') @@ -10,23 +10,11 @@ feature 'Tags' do visit proposals_path within "#proposal_#{earth.id}" do - expect(page).to have_content "Medio Ambiente" + expect(page).to_not have_content "Medio Ambiente" end within "#proposal_#{money.id}" do - expect(page).to have_content "Economía" - end - end - - scenario 'Index shows up to 5 tags per proposal' do - create_featured_proposals - tag_list = ["Hacienda", "Economía", "Medio Ambiente", "Corrupción", "Fiestas populares", "Prensa"] - create :proposal, tag_list: tag_list - - visit proposals_path - - within('.proposal .tags') do - expect(page).to have_content '1+' + expect(page).to_not have_content "Economía" end end @@ -40,21 +28,6 @@ feature 'Tags' do expect(page).to_not have_selector('#featured-proposals') end - scenario 'Index shows 3 tags with no plus link' do - create_featured_proposals - tag_list = ["Medio Ambiente", "Corrupción", "Fiestas populares"] - create :proposal, tag_list: tag_list - - visit proposals_path - - within('.proposal .tags') do - tag_list.each do |tag| - expect(page).to have_content tag - end - expect(page).not_to have_content '+' - end - end - scenario 'Show' do proposal = create(:proposal, tag_list: 'Hacienda, Economía') @@ -196,7 +169,7 @@ feature 'Tags' do context "Filter" do - scenario "From index" do + scenario "Does not from index" do create_featured_proposals proposal1 = create(:proposal, tag_list: 'Education') proposal2 = create(:proposal, tag_list: 'Health') @@ -204,12 +177,11 @@ feature 'Tags' do visit proposals_path within "#proposal_#{proposal1.id}" do - click_link "Education" + expect(page).to_not have_link('Education') end - within("#proposals") do - expect(page).to have_css('.proposal', count: 1) - expect(page).to have_content(proposal1.title) + within "#proposal_#{proposal2.id}" do + expect(page).to_not have_link('Health') end end diff --git a/spec/features/tags_spec.rb b/spec/features/tags_spec.rb index 4ca42f5eb..9e3d65a6e 100644 --- a/spec/features/tags_spec.rb +++ b/spec/features/tags_spec.rb @@ -2,18 +2,18 @@ require 'rails_helper' feature 'Tags' do - scenario 'Index' do + scenario 'Does not show on Index' do earth = create(:debate, tag_list: 'Medio Ambiente') money = create(:debate, tag_list: 'Economía') visit debates_path within "#debate_#{earth.id}" do - expect(page).to have_content "Medio Ambiente" + expect(page).to_not have_content "Medio Ambiente" end within "#debate_#{money.id}" do - expect(page).to have_content "Economía" + expect(page).to_not have_content "Economía" end end