Sha256: 273d44c75ae61fdf39457630a01ec4d421e4166d63022ffbaa04d1d305ccc275

Contents?: true

Size: 1.15 KB

Versions: 8

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 notificable 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

8 entries across 8 versions & 1 rubygems

Version Path
decidim-core-0.28.5 lib/decidim/core/test/shared_examples/digest_mail_examples.rb
decidim-core-0.28.4 lib/decidim/core/test/shared_examples/digest_mail_examples.rb
decidim-core-0.28.3 lib/decidim/core/test/shared_examples/digest_mail_examples.rb
decidim-core-0.28.2 lib/decidim/core/test/shared_examples/digest_mail_examples.rb
decidim-core-0.28.1 lib/decidim/core/test/shared_examples/digest_mail_examples.rb
decidim-core-0.28.0 lib/decidim/core/test/shared_examples/digest_mail_examples.rb
decidim-core-0.28.0.rc5 lib/decidim/core/test/shared_examples/digest_mail_examples.rb
decidim-core-0.28.0.rc4 lib/decidim/core/test/shared_examples/digest_mail_examples.rb