spec/lib/dispatch-rider/publisher_spec.rb in dispatch-rider-2.1.0 vs spec/lib/dispatch-rider/publisher_spec.rb in dispatch-rider-2.2.0
- old
+ new
@@ -1,5 +1,7 @@
+# frozen_string_literal: true
+
require 'spec_helper'
describe DispatchRider::Publisher do
subject(:publisher) { described_class.new }
@@ -53,11 +55,11 @@
expect(subject.register_notification_service(:aws_sns)).to eq(subject)
end
end
describe "#register_channel" do
- before :each do
+ before do
subject.register_notification_service(:aws_sns)
end
let(:notification_service) { subject.notification_service_registrar.fetch(:aws_sns) }
@@ -70,11 +72,11 @@
expect(subject.register_channel(:aws_sns, :foo)).to eq(subject)
end
end
describe "#register_destination" do
- before :each do
+ before do
subject.register_notification_service(:aws_sns)
end
it "registers the destination to be published to" do
subject.register_destination(:sns_foo, :aws_sns, :foo, account: 123, region: "us-east-1", topic: "PlanOfAttack")
@@ -98,21 +100,21 @@
describe "#publish" do
let :notifier do
subject.notification_service_registrar.fetch(:aws_sns).notifier
end
- before :each do
+ before do
subject.register_notification_service(:file_system)
subject.register_destination(:fs_foo, :file_system, :foo, path: "tmp/test_queue")
end
around do |ex|
- begin
- DispatchRider.config.debug = true
- ex.call
- ensure
- DispatchRider.config.debug = false
- end
+
+ DispatchRider.config.debug = true
+ ex.call
+ ensure
+ DispatchRider.config.debug = false
+
end
it "publishes the message to the notification service" do
existing = Dir['tmp/test_queue/*']
expect {