Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid validation when updating user #1022

Merged
merged 1 commit into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/services/never_logged_in_notifier.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def self.send_reminder(person, within)
person.reload
if NeverLoggedInNotifier.send_never_logged_in_reminder? person, within
ReminderMailer.never_logged_in(person).deliver_later
person.update!(last_reminder_email_at: Time.zone.now)
person.update_attribute!(:last_reminder_email_at, Time.zone.now)
end
end

Expand Down
9 changes: 9 additions & 0 deletions spec/services/never_logged_in_notifier_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,18 @@
end

context "when send_never_logged_in_reminder? is true" do
let(:person) { Person.create!(skip_must_have_team: true, given_name: "Peter", surname: "Piper", email: "peter.piper@digital.justice.gov.uk") }
let(:can_send) { true }

include_examples "sends reminder email", :never_logged_in

it "updates the reminder sent date" do
allow(Rails.configuration).to receive(:send_reminder_emails).and_return true

expect {
described_class.send_reminders
}.to(change { person.reload.last_reminder_email_at })
end
end

context "when send_never_logged_in_reminder? is false" do
Expand Down
Loading