debian-mirror-gitlab/spec/workers/namespaces/in_product_marketing_emails_worker_spec.rb

33 lines
1,017 B
Ruby
Raw Normal View History

2021-03-11 19:13:27 +05:30
# frozen_string_literal: true
require 'spec_helper'
2021-09-30 23:02:18 +05:30
RSpec.describe Namespaces::InProductMarketingEmailsWorker, '#perform', unless: Gitlab.ee? do
2021-04-29 21:17:54 +05:30
# Running this in EE would call the overridden method, which can't be tested in CE.
# The EE code is covered in a separate EE spec.
2021-09-30 23:02:18 +05:30
context 'when the in_product_marketing_emails_enabled setting is disabled' do
before do
stub_application_setting(in_product_marketing_emails_enabled: false)
2021-03-11 19:13:27 +05:30
end
2021-09-30 23:02:18 +05:30
it 'does not execute the email service' do
expect(Namespaces::InProductMarketingEmailsService).not_to receive(:send_for_all_tracks_and_intervals)
subject.perform
2021-03-11 19:13:27 +05:30
end
end
2021-09-30 23:02:18 +05:30
context 'when the in_product_marketing_emails_enabled setting is enabled' do
before do
stub_application_setting(in_product_marketing_emails_enabled: true)
2021-04-29 21:17:54 +05:30
end
2021-03-11 19:13:27 +05:30
2021-09-30 23:02:18 +05:30
it 'executes the email service' do
expect(Namespaces::InProductMarketingEmailsService).to receive(:send_for_all_tracks_and_intervals)
subject.perform
2021-03-11 19:13:27 +05:30
end
end
end