Sha256: 09ccdb09f2b2ade93d3aac8e75a2c4200e72693905eb8c0609e69b46fc2d533b

Contents?: true

Size: 1.24 KB

Versions: 9

Compression:

Stored size: 1.24 KB

Contents

describe ActivityNotification::Config do
  describe "config.mailer" do
    let(:notification) { create(:notification) }

    context "as default" do
      it "is configured with ActivityNotification::Mailer" do
        expect(ActivityNotification::Mailer).to receive(:send_notification_email).and_call_original
        notification.send_notification_email send_later: false
      end
  
      it "is not configured with CustomNotificationMailer" do
        expect(CustomNotificationMailer).not_to receive(:send_notification_email).and_call_original
        notification.send_notification_email send_later: false
      end
    end

    context "when it is configured with CustomNotificationMailer" do
      before do
        ActivityNotification.config.mailer = 'CustomNotificationMailer'
        ActivityNotification::Notification.set_notification_mailer
      end

      after do
        ActivityNotification.config.mailer = 'ActivityNotification::Mailer'
        ActivityNotification::Notification.set_notification_mailer
      end

      it "is configured with CustomMailer" do
        expect(CustomNotificationMailer).to receive(:send_notification_email).and_call_original
        notification.send_notification_email send_later: false
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
activity_notification-1.7.1 spec/config_spec.rb
activity_notification-1.7.0 spec/config_spec.rb
activity_notification-1.6.1 spec/config_spec.rb
activity_notification-1.6.0 spec/config_spec.rb
activity_notification-1.5.1 spec/config_spec.rb
activity_notification-1.5.0 spec/config_spec.rb
activity_notification-1.4.4 spec/config_spec.rb
activity_notification-1.4.3 spec/config_spec.rb
activity_notification-1.4.2 spec/config_spec.rb