Skip to content

Commit

Permalink
Make sure the specs have notifier within the region
Browse files Browse the repository at this point in the history
  • Loading branch information
isimluk committed May 12, 2017
1 parent 9c4a302 commit f9ce522
Showing 1 changed file with 23 additions and 14 deletions.
37 changes: 23 additions & 14 deletions spec/mailers/generic_mailer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,30 @@
ActionMailer::Base.deliveries.clear
end

it "call deliver_queue for generic_notification" do
@args[:attachment] = [{:content_type => "text/plain", :filename => "generic_mailer_test.txt", :body => "generic_notification with text/plain attachment" * 10}]
expect(BinaryBlob.count).to eq(0)
GenericMailer.deliver_queue(:generic_notification, @args)
expect(BinaryBlob.count).to eq(1)
expect(MiqQueue.exists?(:method_name => 'deliver',
:class_name => described_class.name,
:role => 'notifier')).to be_truthy
end
context 'with a notifier within a region' do
before do
MiqRegion.seed
ServerRole.seed
@miq_server.server_roles << ServerRole.where(:name => 'notifier')
@miq_server.save!
end

it "call deliver_queue for generic_notification" do
@args[:attachment] = [{:content_type => "text/plain", :filename => "generic_mailer_test.txt", :body => "generic_notification with text/plain attachment" * 10}]
expect(BinaryBlob.count).to eq(0)
GenericMailer.deliver_queue(:generic_notification, @args)
expect(BinaryBlob.count).to eq(1)
expect(MiqQueue.exists?(:method_name => 'deliver',
:class_name => described_class.name,
:role => 'notifier')).to be_truthy
end

it "call deliver_queue for automation_notification" do
GenericMailer.deliver_queue(:automation_notification, @args)
expect(MiqQueue.exists?(:method_name => 'deliver',
:class_name => described_class.name,
:role => 'notifier')).to be_truthy
it "call deliver_queue for automation_notification" do
GenericMailer.deliver_queue(:automation_notification, @args)
expect(MiqQueue.exists?(:method_name => 'deliver',
:class_name => described_class.name,
:role => 'notifier')).to be_truthy
end
end

context "delivery error" do
Expand Down

0 comments on commit f9ce522

Please sign in to comment.