Sha256: 648802f8f05cf6d2f15904523cabf80d1f3a1e27f42470332d67ea05513510bf

Contents?: true

Size: 786 Bytes

Versions: 20

Compression:

Stored size: 786 Bytes

Contents

# frozen_string_literal: true

require "spec_helper"

module Decidim
  module Admin
    describe NewsletterDeliveryJob do
      let(:user) { create(:user) }
      let(:organization) { create(:organization) }
      let(:newsletter) { create(:newsletter, organization: organization, total_deliveries: 0) }

      it "delivers a newsletter to a single user" do
        NewsletterDeliveryJob.perform_now(user, newsletter)

        expect(last_email.subject).to include(newsletter.subject[I18n.locale.to_s])
        expect(last_email.to).to include(user.email)
      end

      it "increments the delivery count" do
        expect do
          NewsletterDeliveryJob.perform_now(user, newsletter)
        end.to change { newsletter.reload.total_deliveries }.by(1)
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
decidim-0.6.8 decidim-admin/spec/jobs/newsletter_delivery_job_spec.rb
decidim-0.6.7 decidim-admin/spec/jobs/newsletter_delivery_job_spec.rb
decidim-0.6.6 decidim-admin/spec/jobs/newsletter_delivery_job_spec.rb
decidim-0.6.5 decidim-admin/spec/jobs/newsletter_delivery_job_spec.rb
decidim-0.6.4 decidim-admin/spec/jobs/newsletter_delivery_job_spec.rb
decidim-0.6.3 decidim-admin/spec/jobs/newsletter_delivery_job_spec.rb
decidim-0.6.2 decidim-admin/spec/jobs/newsletter_delivery_job_spec.rb
decidim-0.6.1 decidim-admin/spec/jobs/newsletter_delivery_job_spec.rb
decidim-0.6.0 decidim-admin/spec/jobs/newsletter_delivery_job_spec.rb
decidim-0.5.1 decidim-admin/spec/jobs/newsletter_delivery_job_spec.rb
decidim-0.5.0 decidim-admin/spec/jobs/newsletter_delivery_job_spec.rb
decidim-0.4.4 decidim-admin/spec/jobs/newsletter_delivery_job_spec.rb
decidim-0.4.3 decidim-admin/spec/jobs/newsletter_delivery_job_spec.rb
decidim-0.4.2 decidim-admin/spec/jobs/newsletter_delivery_job_spec.rb
decidim-0.4.1 decidim-admin/spec/jobs/newsletter_delivery_job_spec.rb
decidim-0.4.0 decidim-admin/spec/jobs/newsletter_delivery_job_spec.rb
decidim-0.3.2 decidim-admin/spec/jobs/newsletter_delivery_job_spec.rb
decidim-0.3.1 decidim-admin/spec/jobs/newsletter_delivery_job_spec.rb
decidim-0.3.0 decidim-admin/spec/jobs/newsletter_delivery_job_spec.rb
decidim-0.2.0 decidim-admin/spec/jobs/newsletter_delivery_job_spec.rb