Sha256: 17e1f6b66423ff18432fee3776f5ab5f370ee564c06abee5e23f98e935888338

Contents?: true

Size: 1.15 KB

Versions: 9

Compression:

Stored size: 1.15 KB

Contents

# frozen_string_literal: true

shared_context "when sends the notification digest" do
  context "when daily notification mail" do
    let(:user) { create(:user, :admin, organization:, notifications_sending_frequency: "daily") }

    it_behaves_like "notification digest mail"
  end

  context "when weekly notification mail" do
    let(:user) { create(:user, :admin, organization:, notifications_sending_frequency: "weekly") }

    it_behaves_like "notification digest mail"
  end
end

shared_examples_for "notification digest mail" do
  context "when a notifiable event takes place" do
    let!(:organization) { create(:organization) }
    let!(:participatory_space) { create(:participatory_process, organization:) }

    it "sends a notification to the user's email" do
      perform_enqueued_jobs do
        expect(command.call).to broadcast(:ok)
        Decidim::Notification.last.update(created_at: 1.day.ago)
        Decidim::EmailNotificationsDigestGeneratorJob.perform_now(user.id, user.notifications_sending_frequency)
      end

      expect(last_email_body.length).to be_positive
      expect(last_email_body).not_to include("translation missing")
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
decidim-core-0.30.0.rc2 lib/decidim/core/test/shared_examples/digest_mail_examples.rb
decidim-core-0.30.0.rc1 lib/decidim/core/test/shared_examples/digest_mail_examples.rb
decidim-core-0.29.2 lib/decidim/core/test/shared_examples/digest_mail_examples.rb
decidim-core-0.29.1 lib/decidim/core/test/shared_examples/digest_mail_examples.rb
decidim-core-0.29.0 lib/decidim/core/test/shared_examples/digest_mail_examples.rb
decidim-core-0.29.0.rc4 lib/decidim/core/test/shared_examples/digest_mail_examples.rb
decidim-core-0.29.0.rc3 lib/decidim/core/test/shared_examples/digest_mail_examples.rb
decidim-core-0.29.0.rc2 lib/decidim/core/test/shared_examples/digest_mail_examples.rb
decidim-core-0.29.0.rc1 lib/decidim/core/test/shared_examples/digest_mail_examples.rb