|
|
@ -36,8 +36,11 @@ RSpec.describe DeviseNotifyMailer do |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
context "when the email domain is in the allowlist" do |
|
|
|
context "when the email domain is in the allowlist" do |
|
|
|
let(:domain) { Rails.application.credentials[:email_allowlist].first } |
|
|
|
before do |
|
|
|
let(:email) { "test@#{domain}" } |
|
|
|
allow(Rails.application.credentials).to receive(:[]).with(:email_allowlist).and_return(["example.com"]) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let(:email) { "test@example.com" } |
|
|
|
|
|
|
|
|
|
|
|
it "does send emails" do |
|
|
|
it "does send emails" do |
|
|
|
expect(notify_client).to receive(:send_email).once |
|
|
|
expect(notify_client).to receive(:send_email).once |
|
|
@ -48,10 +51,10 @@ RSpec.describe DeviseNotifyMailer do |
|
|
|
context "when notify mailer raises BadRequestError" do |
|
|
|
context "when notify mailer raises BadRequestError" do |
|
|
|
before do |
|
|
|
before do |
|
|
|
allow(notify_client).to receive(:send_email).and_raise(bad_request_error) |
|
|
|
allow(notify_client).to receive(:send_email).and_raise(bad_request_error) |
|
|
|
|
|
|
|
allow(Rails.application.credentials).to receive(:[]).with(:email_allowlist).and_return(["example.com"]) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
let(:domain) { Rails.application.credentials[:email_allowlist].first } |
|
|
|
let(:email) { "test@example.com" } |
|
|
|
let(:email) { "test@#{domain}" } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "does not raise an error" do |
|
|
|
it "does not raise an error" do |
|
|
|
expect { |
|
|
|
expect { |
|
|
|