From e20849cd1ce8a267196bd65b2489faf40e5faa50 Mon Sep 17 00:00:00 2001 From: Stephen Chudleigh Date: Wed, 11 Dec 2024 08:48:13 -0800 Subject: [PATCH] update specs, add Capybara matchers --- spec/rails_helper.rb | 1 + spec/requests/submissions_spec.rb | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index 60fd991b..5dadca69 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -78,6 +78,7 @@ config.include EvaluationFormsHelper, type: :system config.include PhasesHelper, type: :system config.include EvaluationCriteriaHelpers, type: :system + config.include Capybara::RSpecMatchers, type: :request config.include FactoryBot::Syntax::Methods config.before(:suite) do diff --git a/spec/requests/submissions_spec.rb b/spec/requests/submissions_spec.rb index 73e5b16a..9060fba7 100644 --- a/spec/requests/submissions_spec.rb +++ b/spec/requests/submissions_spec.rb @@ -55,16 +55,16 @@ end it "renders submission statistics" do - submission = create(:submission, challenge: challenge, phase: phase) - submission_2 = create(:submission, challenge: challenge, phase: phase, judging_status: "selected") - + create(:submission, challenge: challenge, phase: phase) + create(:submission, challenge: challenge, phase: phase, judging_status: "selected") get submissions_phase_path(phase) expect(response.body).to include("Boston Tea Party Cleanup") - # total submissions - expect(response.body).to include("2") + # total submission count + expect(response.body).to have_css("h3.text-primary", text: "Total Submissions") + expect(response.body).to have_css("span.font-sans-3xl.text-primary.text-bold", text: "2") # selected to advance - expect(response.body).to include("1 of 2") + expect(response.body).to have_css("span.text-primary", text: "1 of 2") end end