diff --git a/test/models/config_test.rb b/test/models/config_test.rb index 08a08d6d0..5a5fc7079 100644 --- a/test/models/config_test.rb +++ b/test/models/config_test.rb @@ -367,18 +367,18 @@ class ConfigTest < ActiveSupport::TestCase c = Config.find_or_create_by(config_key: 'use_appointment_date_for_budget_bar_hard_pledges') c.config_value = { options: ["Yes"] } c.save! - assert(Config.use_appointment_date_for_budget_bar_hard_pledges == true) + assert(Config.use_appointment_date_for_budget_bar_hard_pledges? == true) end it 'can return false' do c = Config.find_or_create_by(config_key: 'use_appointment_date_for_budget_bar_hard_pledges') c.config_value = { options: ["No"] } c.save! - assert(Config.use_appointment_date_for_budget_bar_hard_pledges == false) + assert(Config.use_appointment_date_for_budget_bar_hard_pledges? == false) end it "returns false by default" do - assert(Config.use_appointment_date_for_budget_bar_hard_pledges == false) + assert(Config.use_appointment_date_for_budget_bar_hard_pledges? == false) end end end diff --git a/test/models/patient_test.rb b/test/models/patient_test.rb index e9533d83e..165501b6c 100644 --- a/test/models/patient_test.rb +++ b/test/models/patient_test.rb @@ -262,12 +262,12 @@ class PatientTest < ActiveSupport::TestCase it "should swap to appointment date as the hinge if the config is on" do Config.create config_key: :use_appointment_date_for_budget_bar_hard_pledges, - config_value: {options: ['yes']} + config_value: {options: ['Yes']} noon = Time.zone.today.beginning_of_day + 12.hours # to ensure this spec isn't flaky if someone runs it between 12am - 4am ET Timecop.freeze(noon) do - @patient.update appointment_date: 1.day.from_now, fund_pledge: 300, pledge_sent: true, name: 'a', clinic: create(:clinic) + @patient.update appointment_date: 2.days.from_now, fund_pledge: 300, name: 'a', clinic: create(:clinic), fund_pledged_at: 1.day.from_now @patient2.update appointment_date: 1.day.from_now, fund_pledge: 500, name: 'b', pledge_sent: true, clinic: create(:clinic) # Removed because next week @@ -279,13 +279,12 @@ class PatientTest < ActiveSupport::TestCase # Testing dates is hard, so we use name as a proxy here summary = Patient.pledged_status_summary(@line) - assert_not_nil summary[:pledged].find { |pt| pt[:name] == @shaped_patient.name } - assert_not_nil summary[:pledged].find { |pt| pt[:name] == @shaped_patient2.name } - assert_nil summary[:sent].find { |pt| pt[:name] == @filtered_pt.name } - assert_nil summary[:pledged].find { |pt| pt[:name] == @filtered_pt.name } - assert_nil summary[:sent].find { |pt| pt[:name] == @filtered_pt.name } - assert_equal summary[:pledged].count, 2 - assert_equal summary[:sent].count, 0 + assert_not_nil summary[:pledged].find { |pt| pt[:name] == @shaped_patient[:name] } + assert_not_nil summary[:sent].find { |pt| pt[:name] == @shaped_patient2[:name] } + assert_nil summary[:sent].find { |pt| pt[:name] == @filtered_pt[:name] } + assert_nil summary[:pledged].find { |pt| pt[:name] == @filtered_pt[:name] } + assert_equal summary[:pledged].count, 1 + assert_equal summary[:sent].count, 1 end end end