Use visible texts in tests

Content like lowercase letters with `text-transform: uppercase` or
spaces after elements with `display: block` or "You're on page:" are not
seen that way by users with a browser supporting CSS.

So we're testing what most users actually experience.
This commit is contained in:
Javi Martín
2021-03-30 20:00:57 +02:00
parent 23945c2a7c
commit 9cfcbf2f3b
15 changed files with 122 additions and 121 deletions

View File

@@ -807,7 +807,7 @@ describe "Admin budget investments", :admin do
end
end
context "Sorting" do
context "Sorting", :js do
before do
create(:budget_investment, title: "B First Investment", budget: budget, cached_votes_up: 50)
create(:budget_investment, title: "A Second Investment", budget: budget, cached_votes_up: 25)
@@ -831,7 +831,7 @@ describe "Admin budget investments", :admin do
expect("B First Investment").to appear_before("A Second Investment")
expect("A Second Investment").to appear_before("C Third Investment")
within("th", text: "ID") do
expect(page).to have_css(".icon-sortable.desc")
expect(page).to have_css ".icon-sortable.desc", visible: :all
end
end
@@ -841,7 +841,7 @@ describe "Admin budget investments", :admin do
expect("A Second Investment").to appear_before("B First Investment")
expect("B First Investment").to appear_before("C Third Investment")
within("th", text: "Title") do
expect(page).to have_css(".icon-sortable.desc")
expect(page).to have_css ".icon-sortable.desc", visible: :all
end
end
@@ -851,7 +851,7 @@ describe "Admin budget investments", :admin do
expect("C Third Investment").to appear_before("A Second Investment")
expect("A Second Investment").to appear_before("B First Investment")
within("th", text: "Supports") do
expect(page).to have_css(".icon-sortable.desc")
expect(page).to have_css ".icon-sortable.desc", visible: :all
end
end
end
@@ -863,7 +863,7 @@ describe "Admin budget investments", :admin do
expect("C Third Investment").to appear_before("A Second Investment")
expect("A Second Investment").to appear_before("B First Investment")
within("th", text: "ID") do
expect(page).to have_css(".icon-sortable.asc")
expect(page).to have_css ".icon-sortable.asc", visible: :all
end
end
@@ -873,7 +873,7 @@ describe "Admin budget investments", :admin do
expect("C Third Investment").to appear_before("B First Investment")
expect("B First Investment").to appear_before("A Second Investment")
within("th", text: "Title") do
expect(page).to have_css(".icon-sortable.asc")
expect(page).to have_css ".icon-sortable.asc", visible: :all
end
end
@@ -883,7 +883,7 @@ describe "Admin budget investments", :admin do
expect("B First Investment").to appear_before("A Second Investment")
expect("A Second Investment").to appear_before("C Third Investment")
within("th", text: "Supports") do
expect(page).to have_css(".icon-sortable.asc")
expect(page).to have_css ".icon-sortable.asc", visible: :all
end
end
end
@@ -895,7 +895,7 @@ describe "Admin budget investments", :admin do
expect("B First Investment").to appear_before("A Second Investment")
expect("A Second Investment").to appear_before("C Third Investment")
within("th", text: "ID") do
expect(page).to have_css(".icon-sortable.desc")
expect(page).to have_css ".icon-sortable.desc", visible: :all
end
end
@@ -905,7 +905,7 @@ describe "Admin budget investments", :admin do
expect("A Second Investment").to appear_before("B First Investment")
expect("B First Investment").to appear_before("C Third Investment")
within("th", text: "Title") do
expect(page).to have_css(".icon-sortable.desc")
expect(page).to have_css ".icon-sortable.desc", visible: :all
end
end
@@ -915,7 +915,7 @@ describe "Admin budget investments", :admin do
expect("C Third Investment").to appear_before("A Second Investment")
expect("A Second Investment").to appear_before("B First Investment")
within("th", text: "Supports") do
expect(page).to have_css(".icon-sortable.desc")
expect(page).to have_css ".icon-sortable.desc", visible: :all
end
end
end
@@ -927,7 +927,7 @@ describe "Admin budget investments", :admin do
expect("B First Investment").to appear_before("A Second Investment")
expect("A Second Investment").to appear_before("C Third Investment")
within("th", text: "ID") do
expect(page).to have_css(".icon-sortable.desc")
expect(page).to have_css ".icon-sortable.desc", visible: :all
end
end
end

View File

@@ -26,7 +26,7 @@ describe "Admin budgets", :admin do
expect(page).to have_content "Accepting projects"
end
scenario "Filters by phase" do
scenario "Filters by phase", :js do
drafting_budget = create(:budget, :drafting)
accepting_budget = create(:budget, :accepting)
selecting_budget = create(:budget, :selecting)
@@ -41,7 +41,7 @@ describe "Admin budgets", :admin do
expect(page).to have_content(finished_budget.name)
within "#budget_#{finished_budget.id}" do
expect(page).to have_content("Completed")
expect(page).to have_content("COMPLETED")
end
click_link "Finished"

View File

@@ -112,7 +112,7 @@ describe "Homepage", :admin do
xscenario "Deactivate"
end
scenario "Cards" do
scenario "Cards", :js do
card1 = create(:widget_card, label: "Card1 label",
title: "Card1 text",
description: "Card1 description",
@@ -130,8 +130,8 @@ describe "Homepage", :admin do
expect(page).to have_css(".card", count: 2)
within("#widget_card_#{card1.id}") do
expect(page).to have_content("Card1 label")
expect(page).to have_content("Card1 text")
expect(page).to have_content("CARD1 LABEL")
expect(page).to have_content("CARD1 TEXT")
expect(page).to have_content("Card1 description")
expect(page).to have_content("Link1 text")
expect(page).to have_link(href: "consul1.dev")
@@ -139,8 +139,8 @@ describe "Homepage", :admin do
end
within("#widget_card_#{card2.id}") do
expect(page).to have_content("Card2 label")
expect(page).to have_content("Card2 text")
expect(page).to have_content("CARD2 LABEL")
expect(page).to have_content("CARD2 TEXT")
expect(page).to have_content("Card2 description")
expect(page).to have_content("Link2 text")
expect(page).to have_link(href: "consul2.dev")

View File

@@ -1,7 +1,7 @@
require "rails_helper"
describe "Stats", :admin do
context "Summary" do
context "Summary", :js do
scenario "General" do
create(:debate)
2.times { create(:proposal) }
@@ -10,10 +10,10 @@ describe "Stats", :admin do
visit admin_stats_path
expect(page).to have_content "Debates 1"
expect(page).to have_content "Proposals 2"
expect(page).to have_content "Comments 3"
expect(page).to have_content "Visits 4"
expect(page).to have_content "DEBATES\n1"
expect(page).to have_content "PROPOSALS\n2"
expect(page).to have_content "COMMENTS\n3"
expect(page).to have_content "VISITS\n4"
end
scenario "Votes" do
@@ -23,14 +23,14 @@ describe "Stats", :admin do
visit admin_stats_path
expect(page).to have_content "Debate votes 1"
expect(page).to have_content "Proposal votes 2"
expect(page).to have_content "Comment votes 3"
expect(page).to have_content "Total votes 6"
expect(page).to have_content "DEBATE VOTES\n1"
expect(page).to have_content "PROPOSAL VOTES\n2"
expect(page).to have_content "COMMENT VOTES\n3"
expect(page).to have_content "TOTAL VOTES\n6"
end
end
context "Users" do
context "Users", :js do
scenario "Summary" do
1.times { create(:user, :level_three) }
2.times { create(:user, :level_two) }
@@ -38,11 +38,11 @@ describe "Stats", :admin do
visit admin_stats_path
expect(page).to have_content "Level three users 1"
expect(page).to have_content "Level two users 2"
expect(page).to have_content "Verified users 3"
expect(page).to have_content "Unverified users 4"
expect(page).to have_content "Total users 7"
expect(page).to have_content "LEVEL THREE USERS\n1"
expect(page).to have_content "LEVEL TWO USERS\n2"
expect(page).to have_content "VERIFIED USERS\n3"
expect(page).to have_content "UNVERIFIED USERS\n4"
expect(page).to have_content "TOTAL USERS\n7"
end
scenario "Do not count erased users" do
@@ -52,11 +52,11 @@ describe "Stats", :admin do
visit admin_stats_path
expect(page).to have_content "Level three users 0"
expect(page).to have_content "Level two users 0"
expect(page).to have_content "Verified users 0"
expect(page).to have_content "Unverified users 1"
expect(page).to have_content "Total users 1"
expect(page).to have_content "LEVEL THREE USERS\n0"
expect(page).to have_content "LEVEL TWO USERS\n0"
expect(page).to have_content "VERIFIED USERS\n0"
expect(page).to have_content "UNVERIFIED USERS\n1"
expect(page).to have_content "TOTAL USERS\n1"
end
scenario "Do not count hidden users" do
@@ -66,11 +66,11 @@ describe "Stats", :admin do
visit admin_stats_path
expect(page).to have_content "Level three users 0"
expect(page).to have_content "Level two users 0"
expect(page).to have_content "Verified users 0"
expect(page).to have_content "Unverified users 1"
expect(page).to have_content "Total users 1"
expect(page).to have_content "LEVEL THREE USERS\n0"
expect(page).to have_content "LEVEL TWO USERS\n0"
expect(page).to have_content "VERIFIED USERS\n0"
expect(page).to have_content "UNVERIFIED USERS\n1"
expect(page).to have_content "TOTAL USERS\n1"
end
scenario "Level 2 user Graph" do
@@ -82,17 +82,17 @@ describe "Stats", :admin do
visit admin_stats_path
expect(page).to have_content "Level two users 1"
expect(page).to have_content "LEVEL TWO USERS\n1"
end
end
describe "Budget investments" do
describe "Budget investments", :js do
context "Supporting phase" do
let(:budget) { create(:budget) }
let(:group_all_city) { create(:budget_group, budget: budget) }
let!(:heading_all_city) { create(:budget_heading, group: group_all_city) }
scenario "Number of supports in investment projects" do
scenario "Number of supports in investment projects", :js do
group_2 = create(:budget_group, budget: budget)
create(:budget_investment, heading: create(:budget_heading, group: group_2), voters: [create(:user)])
@@ -104,7 +104,7 @@ describe "Stats", :admin do
click_link "Supporting phase"
end
expect(page).to have_content "Votes 3"
expect(page).to have_content "VOTES\n3"
expect(page).to have_link "Go back", count: 1
end
@@ -123,7 +123,7 @@ describe "Stats", :admin do
click_link "Supporting phase"
end
expect(page).to have_content "Participants 2"
expect(page).to have_content "PARTICIPANTS\n2"
end
scenario "Number of users that have supported investments projects per geozone" do
@@ -196,7 +196,7 @@ describe "Stats", :admin do
click_link "Final voting"
end
expect(page).to have_content "Votes 3"
expect(page).to have_content "VOTES\n3"
end
scenario "Number of users that have voted a investment project" do
@@ -210,7 +210,7 @@ describe "Stats", :admin do
click_link "Final voting"
end
expect(page).to have_content "Participants 2"
expect(page).to have_content "PARTICIPANTS\n2"
end
end
end

View File

@@ -188,14 +188,14 @@ describe "Cards", :admin do
expect(page).to have_css("#widget_card_#{card_3.id}.medium-2")
end
scenario "Show label only if it is present" do
scenario "Show label only if it is present", :js do
card_1 = create(:widget_card, cardable: custom_page, title: "Card one", label: "My label")
card_2 = create(:widget_card, cardable: custom_page, title: "Card two")
visit custom_page.url
within("#widget_card_#{card_1.id}") do
expect(page).to have_selector("span", text: "My label")
expect(page).to have_selector("span", text: "MY LABEL")
end
within("#widget_card_#{card_2.id}") do

View File

@@ -16,7 +16,7 @@ describe "Budgets" do
end
context "Index" do
scenario "Show normal index with links" do
scenario "Show normal index with links", :js do
group1 = create(:budget_group, budget: budget)
group2 = create(:budget_group, budget: budget)
heading1 = create(:budget_heading, group: group1)
@@ -33,7 +33,7 @@ describe "Budgets" do
end
within(".budget-subheader") do
expect(page).to have_content "Current phase"
expect(page).to have_content "CURRENT PHASE"
expect(page).to have_content "Information"
end
@@ -99,7 +99,7 @@ describe "Budgets" do
end
end
scenario "Show informing index without links" do
scenario "Show informing index without links", :js do
budget.update!(phase: "informing")
heading = create(:budget_heading, budget: budget)
@@ -107,7 +107,7 @@ describe "Budgets" do
within("#budget_info") do
expect(page).not_to have_link heading.name
expect(page).to have_content "#{heading.name} €1,000,000"
expect(page).to have_content "#{heading.name}\n€1,000,000"
expect(page).not_to have_link("List of all investment projects")
expect(page).not_to have_link("List of all unfeasible investment projects")
@@ -117,7 +117,7 @@ describe "Budgets" do
end
end
scenario "Show finished index without heading links" do
scenario "Show finished index without heading links", :js do
budget.update!(phase: "finished")
heading = create(:budget_heading, budget: budget)
@@ -125,7 +125,7 @@ describe "Budgets" do
within("#budget_info") do
expect(page).not_to have_link heading.name
expect(page).to have_content "#{heading.name} €1,000,000"
expect(page).to have_content "#{heading.name}\n€1,000,000"
expect(page).to have_css("div.map")
end

View File

@@ -305,7 +305,7 @@ describe "Budget Investments" do
expect(order).to eq(new_order)
end
scenario "Random order maintained with pagination" do
scenario "Random order maintained with pagination", :js do
(per_page + 2).times { create(:budget_investment, heading: heading) }
visit budget_investments_path(budget, heading_id: heading.id)
@@ -314,10 +314,10 @@ describe "Budget Investments" do
expect(order).not_to be_empty
click_link "Next"
expect(page).to have_content "You're on page 2"
expect(page).to have_css ".pagination .current", text: "2"
click_link "Previous"
expect(page).to have_content "You're on page 1"
expect(page).to have_css ".pagination .current", text: "1"
new_order = all(".budget-investment h3").map(&:text)
expect(order).to eq(new_order)
@@ -338,7 +338,7 @@ describe "Budget Investments" do
expect(order).to eq(new_order)
end
scenario "Investments are not repeated with random order" do
scenario "Investments are not repeated with random order", :js do
(per_page + 2).times { create(:budget_investment, heading: heading) }
visit budget_investments_path(budget, order: "random")
@@ -346,7 +346,7 @@ describe "Budget Investments" do
first_page_investments = investments_order
click_link "Next"
expect(page).to have_content "You're on page 2"
expect(page).to have_css ".pagination .current", text: "2"
second_page_investments = investments_order
@@ -376,7 +376,7 @@ describe "Budget Investments" do
expect(page).to have_current_path(/page=1/)
end
scenario "Each user has a different and consistent random budget investment order" do
scenario "Each user has a different and consistent random budget investment order", :js do
(per_page * 1.3).to_i.times { create(:budget_investment, heading: heading) }
first_user_investments_order = nil
second_user_investments_order = nil
@@ -395,20 +395,20 @@ describe "Budget Investments" do
in_browser(:one) do
click_link "Next"
expect(page).to have_content "You're on page 2"
expect(page).to have_css ".pagination .current", text: "2"
click_link "Previous"
expect(page).to have_content "You're on page 1"
expect(page).to have_css ".pagination .current", text: "1"
expect(investments_order).to eq(first_user_investments_order)
end
in_browser(:two) do
click_link "Next"
expect(page).to have_content "You're on page 2"
expect(page).to have_css ".pagination .current", text: "2"
click_link "Previous"
expect(page).to have_content "You're on page 1"
expect(page).to have_css ".pagination .current", text: "1"
expect(investments_order).to eq(second_user_investments_order)
end
@@ -919,7 +919,7 @@ describe "Budget Investments" do
expect(page).to have_content("This investment project has not been selected for balloting phase")
end
scenario "Show title (no message)" do
scenario "Show title (no message)", :js do
investment = create(:budget_investment,
:feasible,
:finished,
@@ -932,7 +932,7 @@ describe "Budget Investments" do
visit budget_investment_path(budget, id: investment.id)
within("aside") do
expect(page).to have_content("Investment project")
expect(page).to have_content("INVESTMENT PROJECT")
expect(page).to have_css(".label-budget-investment")
end
end
@@ -1080,12 +1080,12 @@ describe "Budget Investments" do
end
end
scenario "Sidebar in show should display support text" do
scenario "Sidebar in show should display support text", :js do
investment = create(:budget_investment, budget: budget)
visit budget_investment_path(budget, investment)
within("aside") do
expect(page).to have_content "Supports"
expect(page).to have_content "SUPPORTS"
end
end
end
@@ -1095,13 +1095,13 @@ describe "Budget Investments" do
budget.update(phase: "valuating")
end
scenario "Sidebar in show should display support text and count" do
scenario "Sidebar in show should display support text and count", :js do
investment = create(:budget_investment, :selected, budget: budget, voters: [create(:user)])
visit budget_investment_path(budget, investment)
within("aside") do
expect(page).to have_content "Supports"
expect(page).to have_content "SUPPORTS"
expect(page).to have_content "1 support"
end
end
@@ -1116,13 +1116,13 @@ describe "Budget Investments" do
end
end
scenario "Show should display support text and count" do
scenario "Show should display support text and count", :js do
investment = create(:budget_investment, budget: budget, heading: heading, voters: [create(:user)])
visit budget_investment_path(budget, investment)
within("#budget_investment_#{investment.id}") do
expect(page).to have_content "Supports"
expect(page).to have_content "SUPPORTS"
expect(page).to have_content "1 support"
end
end
@@ -1209,12 +1209,12 @@ describe "Budget Investments" do
expect(page).to have_content "€10,000"
end
scenario "Sidebar in show should display vote text" do
scenario "Sidebar in show should display vote text", :js do
investment = create(:budget_investment, :selected, budget: budget)
visit budget_investment_path(budget, investment)
within("aside") do
expect(page).to have_content "Votes"
expect(page).to have_content "VOTES"
end
end
@@ -1304,7 +1304,7 @@ describe "Budget Investments" do
end
end
scenario "Ballot is visible" do
scenario "Ballot is visible", :js do
login_as(author)
visit budget_investments_path(budget, heading_id: heading.id)
@@ -1313,7 +1313,7 @@ describe "Budget Investments" do
expect(page).to have_css("#progress_bar")
within("#sidebar") do
expect(page).to have_content("My ballot")
expect(page).to have_content("MY BALLOT")
expect(page).to have_link("Submit my ballot")
end
end
@@ -1505,20 +1505,20 @@ describe "Budget Investments" do
end
end
scenario "Contains edit button in the accepting phase" do
scenario "Contains edit button in the accepting phase", :js do
investment = create(:budget_investment, heading: heading, author: author)
login_as(author)
visit budget_investment_path(budget, investment)
within("aside") do
expect(page).to have_content "Author"
expect(page).to have_content "AUTHOR"
expect(page).to have_link "Edit"
expect(page).not_to have_link "Remove image"
end
end
scenario "Contains remove image button in phases different from accepting" do
scenario "Contains remove image button in phases different from accepting", :js do
budget.update!(phase: "reviewing")
investment = create(:budget_investment, :with_image, heading: heading, author: author)
@@ -1526,7 +1526,7 @@ describe "Budget Investments" do
visit budget_investment_path(budget, investment)
within("aside") do
expect(page).to have_content "Author"
expect(page).to have_content "AUTHOR"
expect(page).not_to have_link "Edit"
expect(page).to have_link "Remove image"
end

View File

@@ -2,7 +2,7 @@ require "rails_helper"
describe "Communities" do
context "Show" do
scenario "Should display default content" do
scenario "Should display default content", :js do
proposal = create(:proposal)
community = proposal.community
user = create(:user)
@@ -10,7 +10,7 @@ describe "Communities" do
visit community_path(community)
expect(page).to have_content "Proposal community"
expect(page).to have_content "PROPOSAL COMMUNITY"
expect(page).to have_content proposal.title
expect(page).to have_content "Participate in the community of this proposal"
expect(page).to have_link("Create topic", href: new_community_topic_path(community))

View File

@@ -379,7 +379,7 @@ describe "Proposal's dashboard" do
anchor: "tab-notifications"))
end
scenario "Dashboard has a related content section" do
scenario "Dashboard has a related content section", :js do
related_debate = create(:debate)
related_proposal = create(:proposal)
@@ -399,9 +399,9 @@ describe "Proposal's dashboard" do
within(".dashboard-related-content") do
expect(page).to have_content("Related content (2)")
expect(page).to have_selector(".related-content-title", text: "Proposal")
expect(page).to have_selector(".related-content-title", text: "PROPOSAL")
expect(page).to have_link related_proposal.title
expect(page).to have_selector(".related-content-title", text: "Debate")
expect(page).to have_selector(".related-content-title", text: "DEBATE")
expect(page).to have_link related_debate.title
end
end

View File

@@ -800,13 +800,14 @@ describe "Debates" do
end
end
scenario "Index include featured debates", :admin do
scenario "Index include featured debates", :admin, :js do
create(:debate, featured_at: Time.current)
create(:debate)
visit debates_path
within("#debates") do
expect(page).to have_content("Featured")
expect(page).to have_content("FEATURED")
end
end

View File

@@ -162,17 +162,17 @@ describe "Legislation" do
end
end
scenario "show draft publication and final result publication dates" do
scenario "show draft publication and final result publication dates", :js do
process = create(:legislation_process, draft_publication_date: Date.new(2019, 01, 10),
result_publication_date: Date.new(2019, 01, 20))
visit legislation_process_path(process)
within("aside") do
expect(page).to have_content("Draft publication")
expect(page).to have_content("10 Jan 2019")
expect(page).to have_content("Final result publication")
expect(page).to have_content("20 Jan 2019")
expect(page).to have_content "DRAFT PUBLICATION"
expect(page).to have_content "10 Jan 2019"
expect(page).to have_content "FINAL RESULT PUBLICATION"
expect(page).to have_content "20 Jan 2019"
end
end

View File

@@ -82,11 +82,11 @@ describe "Legislation Proposals" do
expect(legislation_proposals_order).to eq(first_page_proposals_order)
end
scenario "Does not crash when the seed is not a number" do
scenario "Does not crash when the seed is not a number", :js do
login_as user
visit legislation_process_proposals_path(process, random_seed: "Spoof")
expect(page).to have_content "You're on page 1"
expect(page).to have_content "Random"
end
end
@@ -200,13 +200,13 @@ describe "Legislation Proposals" do
expect(page).to have_content("-6 votes")
end
scenario "Show link to process on show" do
scenario "Show link to process on show", :js do
create(:legislation_proposal, legislation_process_id: process.id)
visit legislation_process_proposal_path(proposal.process, proposal)
within(".process-proposal") do
expect(page).to have_content("Collaborative legislation process")
expect(page).to have_content("COLLABORATIVE LEGISLATION PROCESS")
expect(page).to have_link(process.title)
end
end

View File

@@ -14,7 +14,7 @@ describe "Legislation" do
create(:legislation_question, process: process, title: "Question 3")
end
scenario "shows question list" do
scenario "shows question list", :js do
visit legislation_process_path(process)
expect(page).to have_content("Participate in the debate")
@@ -26,17 +26,17 @@ describe "Legislation" do
click_link "Question 1"
expect(page).to have_content("Question 1")
expect(page).to have_content("Next question")
expect(page).to have_content("NEXT QUESTION")
click_link "Next question"
expect(page).to have_content("Question 2")
expect(page).to have_content("Next question")
expect(page).to have_content("NEXT QUESTION")
click_link "Next question"
expect(page).to have_content("Question 3")
expect(page).not_to have_content("Next question")
expect(page).not_to have_content("NEXT QUESTION")
end
scenario "shows question page" do
@@ -46,21 +46,21 @@ describe "Legislation" do
expect(page).to have_content("Open answers (0)")
end
scenario "shows next question link in question page" do
scenario "shows next question link in question page", :js do
visit legislation_process_question_path(process, process.questions.first)
expect(page).to have_content("Question 1")
expect(page).to have_content("Next question")
expect(page).to have_content("NEXT QUESTION")
click_link "Next question"
expect(page).to have_content("Question 2")
expect(page).to have_content("Next question")
expect(page).to have_content("NEXT QUESTION")
click_link "Next question"
expect(page).to have_content("Question 3")
expect(page).not_to have_content("Next question")
expect(page).not_to have_content("NEXT QUESTION")
end
scenario "answer question", :no_js do

View File

@@ -87,13 +87,13 @@ describe "Custom Pages" do
expect(page).to have_content("Subtitle for custom page")
end
scenario "Show widget cards for that page" do
scenario "Show widget cards for that page", :js do
custom_page = create(:site_customization_page, :published)
create(:widget_card, cardable: custom_page, title: "Card Highlights")
visit custom_page.url
expect(page).to have_content "Card Highlights"
expect(page).to have_content "CARD HIGHLIGHTS"
end
end
end

View File

@@ -1,6 +1,6 @@
require "rails_helper"
describe "Stats" do
describe "Stats", :js do
context "Summary" do
scenario "General" do
create(:debate)
@@ -10,10 +10,10 @@ describe "Stats" do
visit stats_path
expect(page).to have_content "Debates 1"
expect(page).to have_content "Proposals 2"
expect(page).to have_content "Comments 3"
expect(page).to have_content "Visits 4"
expect(page).to have_content "DEBATES\n1"
expect(page).to have_content "PROPOSALS\n2"
expect(page).to have_content "COMMENTS\n3"
expect(page).to have_content "VISITS\n4"
end
scenario "Votes" do
@@ -23,10 +23,10 @@ describe "Stats" do
visit stats_path
expect(page).to have_content "Votes on debates 1"
expect(page).to have_content "Votes on proposals 2"
expect(page).to have_content "Votes on comments 3"
expect(page).to have_content "Total votes 6"
expect(page).to have_content "VOTES ON DEBATES\n1"
expect(page).to have_content "VOTES ON PROPOSALS\n2"
expect(page).to have_content "VOTES ON COMMENTS\n3"
expect(page).to have_content "TOTAL VOTES\n6"
end
scenario "Users" do
@@ -36,8 +36,8 @@ describe "Stats" do
visit stats_path
expect(page).to have_content "Verified users 3"
expect(page).to have_content "Unverified users 2"
expect(page).to have_content "VERIFIED USERS\n3"
expect(page).to have_content "UNVERIFIED USERS\n2"
end
end
end