From 6ee5c0fcb8556120bab5b37a7598a4ba0132fd9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Fri, 12 Apr 2024 17:40:04 +0200 Subject: [PATCH] Simplify expectations in "select all/none" tests --- spec/system/moderation/budget_investments_spec.rb | 6 ++---- spec/system/moderation/comments_spec.rb | 6 ++---- spec/system/moderation/debates_spec.rb | 6 ++---- spec/system/moderation/proposal_notifications_spec.rb | 6 ++---- spec/system/moderation/proposals_spec.rb | 6 ++---- 5 files changed, 10 insertions(+), 20 deletions(-) diff --git a/spec/system/moderation/budget_investments_spec.rb b/spec/system/moderation/budget_investments_spec.rb index 88b813c35..631a86836 100644 --- a/spec/system/moderation/budget_investments_spec.rb +++ b/spec/system/moderation/budget_investments_spec.rb @@ -114,13 +114,11 @@ describe "Moderate budget investments" do within(".js-check") { click_link "All" } - expect(all("input[type=checkbox]")).to all(be_checked) + expect(all(:checkbox)).to all(be_checked) within(".js-check") { click_link "None" } - all("input[type=checkbox]").each do |checkbox| - expect(checkbox).not_to be_checked - end + all(:checkbox).each { |checkbox| expect(checkbox).not_to be_checked } end scenario "remembering page, filter and order" do diff --git a/spec/system/moderation/comments_spec.rb b/spec/system/moderation/comments_spec.rb index 69af01fc0..8d1ff8f31 100644 --- a/spec/system/moderation/comments_spec.rb +++ b/spec/system/moderation/comments_spec.rb @@ -134,13 +134,11 @@ describe "Moderate comments" do within(".js-check") { click_link "All" } - expect(all("input[type=checkbox]")).to all(be_checked) + expect(all(:checkbox)).to all(be_checked) within(".js-check") { click_link "None" } - all("input[type=checkbox]").each do |checkbox| - expect(checkbox).not_to be_checked - end + all(:checkbox).each { |checkbox| expect(checkbox).not_to be_checked } end scenario "remembering page, filter and order" do diff --git a/spec/system/moderation/debates_spec.rb b/spec/system/moderation/debates_spec.rb index 8e3289d51..45675d264 100644 --- a/spec/system/moderation/debates_spec.rb +++ b/spec/system/moderation/debates_spec.rb @@ -103,13 +103,11 @@ describe "Moderate debates" do within(".js-check") { click_link "All" } - expect(all("input[type=checkbox]")).to all(be_checked) + expect(all(:checkbox)).to all(be_checked) within(".js-check") { click_link "None" } - all("input[type=checkbox]").each do |checkbox| - expect(checkbox).not_to be_checked - end + all(:checkbox).each { |checkbox| expect(checkbox).not_to be_checked } end scenario "remembering page, filter and order" do diff --git a/spec/system/moderation/proposal_notifications_spec.rb b/spec/system/moderation/proposal_notifications_spec.rb index 70a362a1e..55b7f0c78 100644 --- a/spec/system/moderation/proposal_notifications_spec.rb +++ b/spec/system/moderation/proposal_notifications_spec.rb @@ -114,13 +114,11 @@ describe "Moderate proposal notifications" do within(".js-check") { click_link "All" } - expect(all("input[type=checkbox]")).to all(be_checked) + expect(all(:checkbox)).to all(be_checked) within(".js-check") { click_link "None" } - all("input[type=checkbox]").each do |checkbox| - expect(checkbox).not_to be_checked - end + all(:checkbox).each { |checkbox| expect(checkbox).not_to be_checked } end scenario "remembering page, filter and order" do diff --git a/spec/system/moderation/proposals_spec.rb b/spec/system/moderation/proposals_spec.rb index 7779ad3fe..305a00dc8 100644 --- a/spec/system/moderation/proposals_spec.rb +++ b/spec/system/moderation/proposals_spec.rb @@ -102,13 +102,11 @@ describe "Moderate proposals" do within(".js-check") { click_link "All" } - expect(all("input[type=checkbox]")).to all(be_checked) + expect(all(:checkbox)).to all(be_checked) within(".js-check") { click_link "None" } - all("input[type=checkbox]").each do |checkbox| - expect(checkbox).not_to be_checked - end + all(:checkbox).each { |checkbox| expect(checkbox).not_to be_checked } end scenario "remembering page, filter and order" do