dispatch-rider 2.1.0 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +21 -0
- data/.rubocop_todo.yml +17 -300
- data/Rakefile +2 -1
- data/dispatch-rider.gemspec +2 -2
- data/lib/dispatch-rider/callbacks/access.rb +2 -0
- data/lib/dispatch-rider/callbacks/storage.rb +7 -5
- data/lib/dispatch-rider/callbacks/support.rb +2 -0
- data/lib/dispatch-rider/callbacks.rb +2 -0
- data/lib/dispatch-rider/command.rb +3 -3
- data/lib/dispatch-rider/configuration.rb +3 -1
- data/lib/dispatch-rider/debug.rb +3 -1
- data/lib/dispatch-rider/demultiplexer.rb +17 -19
- data/lib/dispatch-rider/dispatcher.rb +2 -0
- data/lib/dispatch-rider/error_handlers.rb +3 -1
- data/lib/dispatch-rider/errors.rb +2 -0
- data/lib/dispatch-rider/handlers/base.rb +12 -10
- data/lib/dispatch-rider/handlers/inheritance_tracking.rb +2 -0
- data/lib/dispatch-rider/handlers/named_process.rb +2 -0
- data/lib/dispatch-rider/handlers.rb +2 -0
- data/lib/dispatch-rider/integrations/appsignal.rb +3 -1
- data/lib/dispatch-rider/logging/json_formatter.rb +2 -0
- data/lib/dispatch-rider/logging/lifecycle_logger.rb +2 -0
- data/lib/dispatch-rider/logging/text_formatter.rb +2 -0
- data/lib/dispatch-rider/logging/translator/base_translator.rb +2 -0
- data/lib/dispatch-rider/logging/translator/complete_translator.rb +2 -0
- data/lib/dispatch-rider/logging/translator/error_handler_fail_translator.rb +2 -0
- data/lib/dispatch-rider/logging/translator/fail_translator.rb +2 -0
- data/lib/dispatch-rider/logging/translator/start_translator.rb +2 -0
- data/lib/dispatch-rider/logging/translator/stop_translator.rb +2 -0
- data/lib/dispatch-rider/logging/translator/success_translator.rb +2 -0
- data/lib/dispatch-rider/logging/translator.rb +2 -0
- data/lib/dispatch-rider/logging.rb +2 -0
- data/lib/dispatch-rider/message.rb +3 -0
- data/lib/dispatch-rider/notification_services/aws_sns.rb +5 -3
- data/lib/dispatch-rider/notification_services/base.rb +2 -0
- data/lib/dispatch-rider/notification_services/file_system/channel.rb +2 -0
- data/lib/dispatch-rider/notification_services/file_system/notifier.rb +2 -0
- data/lib/dispatch-rider/notification_services/file_system.rb +3 -1
- data/lib/dispatch-rider/notification_services.rb +2 -0
- data/lib/dispatch-rider/publisher/base.rb +2 -0
- data/lib/dispatch-rider/publisher/configuration/destination.rb +6 -4
- data/lib/dispatch-rider/publisher/configuration/notification_service.rb +4 -2
- data/lib/dispatch-rider/publisher/configuration.rb +2 -0
- data/lib/dispatch-rider/publisher/configuration_reader.rb +2 -0
- data/lib/dispatch-rider/publisher/configuration_support.rb +3 -1
- data/lib/dispatch-rider/publisher.rb +3 -2
- data/lib/dispatch-rider/queue_services/aws_sqs/message_body_extractor.rb +2 -0
- data/lib/dispatch-rider/queue_services/aws_sqs/sqs_received_message.rb +6 -4
- data/lib/dispatch-rider/queue_services/aws_sqs.rb +5 -2
- data/lib/dispatch-rider/queue_services/base.rb +5 -4
- data/lib/dispatch-rider/queue_services/file_system/fs_received_message.rb +5 -3
- data/lib/dispatch-rider/queue_services/file_system/queue.rb +5 -4
- data/lib/dispatch-rider/queue_services/file_system.rb +7 -11
- data/lib/dispatch-rider/queue_services/received_message.rb +3 -1
- data/lib/dispatch-rider/queue_services/simple.rb +5 -7
- data/lib/dispatch-rider/queue_services.rb +2 -0
- data/lib/dispatch-rider/registrars/base.rb +5 -5
- data/lib/dispatch-rider/registrars/file_system_channel.rb +3 -1
- data/lib/dispatch-rider/registrars/handler.rb +3 -1
- data/lib/dispatch-rider/registrars/notification_service.rb +2 -0
- data/lib/dispatch-rider/registrars/publishing_destination.rb +3 -1
- data/lib/dispatch-rider/registrars/queue_service.rb +2 -0
- data/lib/dispatch-rider/registrars/sns_channel.rb +3 -1
- data/lib/dispatch-rider/registrars.rb +2 -0
- data/lib/dispatch-rider/runner.rb +2 -0
- data/lib/dispatch-rider/scheduled_job/migration.rb +2 -0
- data/lib/dispatch-rider/scheduled_job.rb +3 -3
- data/lib/dispatch-rider/subscriber.rb +2 -0
- data/lib/dispatch-rider/version.rb +3 -1
- data/lib/dispatch-rider.rb +3 -1
- data/lib/generators/dispatch_rider/install/install_generator.rb +2 -0
- data/lib/generators/dispatch_rider/install/templates/script/dispatch_rider +1 -0
- data/lib/generators/dispatch_rider/job/dispatch_job_generator.rb +2 -0
- data/spec/factories/messages.rb +4 -1
- data/spec/fixtures/handlers/another_test_handler.rb +2 -0
- data/spec/fixtures/handlers/test_handler.rb +2 -0
- data/spec/integration/logging_spec.rb +2 -0
- data/spec/lib/dispatch-rider/airbrake_error_handler_spec.rb +3 -1
- data/spec/lib/dispatch-rider/callbacks/access_spec.rb +2 -0
- data/spec/lib/dispatch-rider/callbacks/storage_spec.rb +2 -0
- data/spec/lib/dispatch-rider/configuration_spec.rb +3 -1
- data/spec/lib/dispatch-rider/default_error_handler_spec.rb +2 -0
- data/spec/lib/dispatch-rider/demultiplexer_spec.rb +4 -2
- data/spec/lib/dispatch-rider/dispatcher_spec.rb +12 -9
- data/spec/lib/dispatch-rider/handlers/base_spec.rb +2 -0
- data/spec/lib/dispatch-rider/handlers/inheritance_tracking_spec.rb +2 -0
- data/spec/lib/dispatch-rider/logging/json_formatter_spec.rb +2 -0
- data/spec/lib/dispatch-rider/logging/lifecycle_logger_spec.rb +3 -1
- data/spec/lib/dispatch-rider/logging/text_formatter_spec.rb +2 -0
- data/spec/lib/dispatch-rider/logging/translator_spec.rb +2 -0
- data/spec/lib/dispatch-rider/message_spec.rb +7 -5
- data/spec/lib/dispatch-rider/notification_services/aws_sns_spec.rb +2 -0
- data/spec/lib/dispatch-rider/notification_services/base_spec.rb +6 -4
- data/spec/lib/dispatch-rider/notification_services/file_system/channel_spec.rb +2 -0
- data/spec/lib/dispatch-rider/notification_services/file_system/notifier_spec.rb +2 -0
- data/spec/lib/dispatch-rider/notification_services/file_system_spec.rb +2 -0
- data/spec/lib/dispatch-rider/notification_services_spec.rb +2 -0
- data/spec/lib/dispatch-rider/publisher/base_spec.rb +2 -0
- data/spec/lib/dispatch-rider/publisher/configuration/destination_spec.rb +2 -0
- data/spec/lib/dispatch-rider/publisher/configuration/notification_service_spec.rb +2 -0
- data/spec/lib/dispatch-rider/publisher/configuration_reader_spec.rb +3 -1
- data/spec/lib/dispatch-rider/publisher/configuration_spec.rb +3 -1
- data/spec/lib/dispatch-rider/publisher/configuration_support_spec.rb +4 -2
- data/spec/lib/dispatch-rider/publisher_spec.rb +11 -9
- data/spec/lib/dispatch-rider/queue_services/aws_sqs_spec.rb +11 -4
- data/spec/lib/dispatch-rider/queue_services/base_spec.rb +10 -8
- data/spec/lib/dispatch-rider/queue_services/file_system_spec.rb +7 -5
- data/spec/lib/dispatch-rider/queue_services/received_message_spec.rb +2 -0
- data/spec/lib/dispatch-rider/queue_services/simple_spec.rb +6 -4
- data/spec/lib/dispatch-rider/registrars/base_spec.rb +4 -2
- data/spec/lib/dispatch-rider/registrars/file_system_channel_spec.rb +2 -0
- data/spec/lib/dispatch-rider/registrars/handler_spec.rb +2 -0
- data/spec/lib/dispatch-rider/registrars/notification_service_spec.rb +2 -0
- data/spec/lib/dispatch-rider/registrars/publishing_destination_spec.rb +2 -0
- data/spec/lib/dispatch-rider/registrars/queue_service_spec.rb +2 -0
- data/spec/lib/dispatch-rider/registrars/sns_channel_spec.rb +2 -0
- data/spec/lib/dispatch-rider/registrars_spec.rb +2 -0
- data/spec/lib/dispatch-rider/runner_spec.rb +3 -1
- data/spec/lib/dispatch-rider/scheduled_job_spec.rb +2 -0
- data/spec/lib/dispatch-rider/subscriber_spec.rb +6 -3
- data/spec/lib/dispatch-rider_spec.rb +2 -0
- data/spec/spec_helper.rb +1 -1
- data/spec/support/crashing_handler.rb +2 -0
- data/spec/support/integration_support.rb +2 -0
- data/spec/support/null_logger.rb +2 -0
- data/spec/support/sample_handler.rb +2 -0
- metadata +29 -29
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# This is a rudementary queue service that uses file system instead of
|
2
4
|
# Aws::SQS or SimpleQueue. It addresses SimpleQueue's inability to be used
|
3
5
|
# by only one application instance while avoiding the cost of setting up Aws::SQS.
|
@@ -8,12 +10,10 @@ module DispatchRider
|
|
8
10
|
require "dispatch-rider/queue_services/file_system/fs_received_message"
|
9
11
|
class FileSystem < Base
|
10
12
|
def assign_storage(attrs)
|
11
|
-
begin
|
12
13
|
path = attrs.fetch(:path)
|
13
14
|
Queue.new(path)
|
14
|
-
|
15
|
+
rescue IndexError
|
15
16
|
raise RecordInvalid.new(self, ["Path can not be blank"])
|
16
|
-
end
|
17
17
|
end
|
18
18
|
|
19
19
|
def insert(item)
|
@@ -23,7 +23,7 @@ module DispatchRider
|
|
23
23
|
def raw_head
|
24
24
|
queue.pop
|
25
25
|
end
|
26
|
-
|
26
|
+
|
27
27
|
def received_message_for(raw_item)
|
28
28
|
FsReceivedMessage.new(construct_message_from(raw_item), raw_item, queue)
|
29
29
|
end
|
@@ -31,18 +31,14 @@ module DispatchRider
|
|
31
31
|
def construct_message_from(item)
|
32
32
|
deserialize(item.read)
|
33
33
|
end
|
34
|
-
|
35
|
-
|
36
|
-
queue.put_back(item)
|
37
|
-
end
|
34
|
+
|
35
|
+
delegate :put_back, to: :queue
|
38
36
|
|
39
37
|
def delete(item)
|
40
38
|
queue.remove item
|
41
39
|
end
|
42
40
|
|
43
|
-
|
44
|
-
queue.size
|
45
|
-
end
|
41
|
+
delegate :size, to: :queue
|
46
42
|
end
|
47
43
|
end
|
48
44
|
end
|
@@ -1,8 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# This is a simple implementation of an in memory queue using an array.
|
2
4
|
module DispatchRider
|
3
5
|
module QueueServices
|
4
6
|
class Simple < Base
|
5
|
-
def assign_storage(
|
7
|
+
def assign_storage(_attrs)
|
6
8
|
[]
|
7
9
|
end
|
8
10
|
|
@@ -18,13 +20,9 @@ module DispatchRider
|
|
18
20
|
deserialize(item)
|
19
21
|
end
|
20
22
|
|
21
|
-
|
22
|
-
queue.delete(item)
|
23
|
-
end
|
23
|
+
delegate :delete, to: :queue
|
24
24
|
|
25
|
-
|
26
|
-
queue.size
|
27
|
-
end
|
25
|
+
delegate :size, to: :queue
|
28
26
|
end
|
29
27
|
end
|
30
28
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# This is the base class for the registrars.
|
2
4
|
# It defines the interface that other registrars inherit.
|
3
5
|
# This is an abstract class.
|
@@ -28,11 +30,9 @@ module DispatchRider
|
|
28
30
|
end
|
29
31
|
|
30
32
|
def fetch(name)
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
raise NotRegistered, name
|
35
|
-
end
|
33
|
+
store.fetch(name.to_sym)
|
34
|
+
rescue IndexError
|
35
|
+
raise NotRegistered, name
|
36
36
|
end
|
37
37
|
end
|
38
38
|
end
|
@@ -1,9 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# This is the registrar for FileSystem channels, basically storing paths
|
2
4
|
|
3
5
|
module DispatchRider
|
4
6
|
module Registrars
|
5
7
|
class FileSystemChannel < Base
|
6
|
-
def value(
|
8
|
+
def value(_name, options = {})
|
7
9
|
File.expand_path(options[:path])
|
8
10
|
end
|
9
11
|
end
|
@@ -1,9 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'ostruct'
|
2
4
|
|
3
5
|
module DispatchRider
|
4
6
|
module Registrars
|
5
7
|
class PublishingDestination < Base
|
6
|
-
def value(
|
8
|
+
def value(_name, options = {})
|
7
9
|
::OpenStruct.new(:service => options[:service], :channel => options[:channel])
|
8
10
|
end
|
9
11
|
end
|
@@ -1,8 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# This is the registrar for the Aws SNS channels.
|
2
4
|
module DispatchRider
|
3
5
|
module Registrars
|
4
6
|
class SnsChannel < Base
|
5
|
-
def value(
|
7
|
+
def value(_name, options = {})
|
6
8
|
"arn:aws:sns:#{options[:region]}:#{options[:account]}:#{options[:topic]}"
|
7
9
|
end
|
8
10
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "active_record"
|
2
4
|
|
3
5
|
# @note: Later this could be pulled out to its own gem and included depending on what ORM the user
|
@@ -50,9 +52,7 @@ module DispatchRider
|
|
50
52
|
destroy # once published
|
51
53
|
end
|
52
54
|
|
53
|
-
|
54
|
-
|
55
|
-
delegate :publisher, to: :"self.class"
|
55
|
+
delegate :publisher, to: :'self.class'
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
data/lib/dispatch-rider.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# Top level namespace of the gem
|
2
4
|
require "dispatch-rider/version"
|
3
5
|
|
@@ -22,7 +24,7 @@ module DispatchRider
|
|
22
24
|
def configuration
|
23
25
|
@configuration ||= Configuration.new
|
24
26
|
end
|
25
|
-
|
27
|
+
alias config configuration
|
26
28
|
|
27
29
|
def clear_configuration!
|
28
30
|
@configuration = nil
|
data/spec/factories/messages.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
FactoryBot.define do
|
2
4
|
factory :message, class: 'DispatchRider::Message' do
|
3
5
|
subject { 'sample_handler' }
|
@@ -5,7 +7,8 @@ FactoryBot.define do
|
|
5
7
|
{
|
6
8
|
'key' => 'value',
|
7
9
|
'guid' => DispatchRider::Debug::PUBLISHER_MESSAGE_GUID,
|
8
|
-
}
|
10
|
+
}
|
11
|
+
}
|
9
12
|
initialize_with { DispatchRider::Message.new(attributes) }
|
10
13
|
end
|
11
14
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "spec_helper"
|
2
4
|
|
3
5
|
describe DispatchRider::AirbrakeErrorHandler do
|
@@ -12,7 +14,7 @@ describe DispatchRider::AirbrakeErrorHandler do
|
|
12
14
|
controller: "DispatchRider",
|
13
15
|
action: "TestMessage",
|
14
16
|
parameters: { subject: "TestMessage", body: "foo" },
|
15
|
-
cgi_data: anything
|
17
|
+
cgi_data: anything
|
16
18
|
]
|
17
19
|
expect(Airbrake).to receive(:notify).with(*args)
|
18
20
|
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
|
3
5
|
describe DispatchRider::Configuration do
|
@@ -33,7 +35,7 @@ describe DispatchRider::Configuration do
|
|
33
35
|
end
|
34
36
|
|
35
37
|
describe "#handlers" do
|
36
|
-
before
|
38
|
+
before do
|
37
39
|
subject.handler_path = "./spec/fixtures/handlers"
|
38
40
|
end
|
39
41
|
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
|
3
5
|
describe DispatchRider::Demultiplexer, nodb: true do
|
@@ -7,7 +9,7 @@ describe DispatchRider::Demultiplexer, nodb: true do
|
|
7
9
|
end
|
8
10
|
end
|
9
11
|
|
10
|
-
subject(:demultiplexer) {
|
12
|
+
subject(:demultiplexer) { described_class.new(queue, dispatcher, error_handler) }
|
11
13
|
|
12
14
|
let(:dispatcher) do
|
13
15
|
dispatcher = DispatchRider::Dispatcher.new
|
@@ -62,7 +64,7 @@ describe DispatchRider::Demultiplexer, nodb: true do
|
|
62
64
|
# THIS ALSO TESTS THAT THE JOB IS NOT RUN MULTIPLE TIMES
|
63
65
|
# IF THIS FAILS, BE CAREFUL NOT TO INTRODUCE BUGS
|
64
66
|
it "should call the correct handler" do
|
65
|
-
expect_any_instance_of(TestHandler).to receive(:process).with(message.body).at_least(
|
67
|
+
expect_any_instance_of(TestHandler).to receive(:process).with(message.body).at_least(:once)
|
66
68
|
demultiplexer_thread.run
|
67
69
|
sleep 0.01 # give it a chance to process the job async before killing the demux
|
68
70
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
|
3
5
|
describe DispatchRider::Dispatcher, :nodb => true do
|
@@ -30,16 +32,17 @@ describe DispatchRider::Dispatcher, :nodb => true do
|
|
30
32
|
before do
|
31
33
|
allow(DispatchRider.config).to receive(:callbacks) { storage }
|
32
34
|
storage.around(:dispatch_message) do |block, message|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
35
|
+
|
36
|
+
dummy.before
|
37
|
+
dummy.log(message)
|
38
|
+
block.call
|
39
|
+
ensure
|
40
|
+
dummy.after
|
41
|
+
|
40
42
|
end
|
41
43
|
subject.register('handle_something')
|
42
44
|
end
|
45
|
+
|
43
46
|
example do
|
44
47
|
expect(dummy).to receive(:before).once
|
45
48
|
expect(dummy).to receive(:after).once
|
@@ -51,7 +54,7 @@ describe DispatchRider::Dispatcher, :nodb => true do
|
|
51
54
|
end
|
52
55
|
|
53
56
|
context "when the handler provided in the message is present" do
|
54
|
-
before
|
57
|
+
before do
|
55
58
|
subject.register('handle_something')
|
56
59
|
end
|
57
60
|
|
@@ -63,7 +66,7 @@ describe DispatchRider::Dispatcher, :nodb => true do
|
|
63
66
|
context "when the handler returns false" do
|
64
67
|
let(:message_subject) { "handler_that_returns_false" }
|
65
68
|
|
66
|
-
before
|
69
|
+
before do
|
67
70
|
subject.register('handler_that_returns_false')
|
68
71
|
end
|
69
72
|
|
@@ -1,7 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
|
3
5
|
describe DispatchRider::Logging::LifecycleLogger, aggregrate_failures: true do
|
4
|
-
subject {
|
6
|
+
subject { described_class }
|
5
7
|
|
6
8
|
let(:queue) { double :queue }
|
7
9
|
let(:item) { double :item }
|
@@ -1,12 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
|
3
5
|
describe DispatchRider::Message do
|
4
|
-
subject(:message) {
|
6
|
+
subject(:message) { described_class.new(subject: 'test', body: 'test_handler') }
|
5
7
|
|
6
8
|
describe "#initialize" do
|
7
9
|
context "when all the required attributes are passed" do
|
8
10
|
context "when the attributes hash has keys as strings" do
|
9
|
-
subject(:message) {
|
11
|
+
subject(:message) { described_class.new('subject' => 'test', 'body' => 'test_handler') }
|
10
12
|
|
11
13
|
it "should initiate a new message" do
|
12
14
|
expect(message.subject).to eq('test')
|
@@ -24,7 +26,7 @@ describe DispatchRider::Message do
|
|
24
26
|
|
25
27
|
context "when all the required attributes are not passed" do
|
26
28
|
it "should raise an exception" do
|
27
|
-
expect {
|
29
|
+
expect { described_class.new({}) }.to raise_exception(DispatchRider::RecordInvalid)
|
28
30
|
end
|
29
31
|
end
|
30
32
|
end
|
@@ -46,13 +48,13 @@ describe DispatchRider::Message do
|
|
46
48
|
describe "#==" do
|
47
49
|
context "when 2 messages have the same attribute values" do
|
48
50
|
it "should return true" do
|
49
|
-
expect(message).to eq(
|
51
|
+
expect(message).to eq(described_class.new(subject: 'test', body: 'test_handler'))
|
50
52
|
end
|
51
53
|
end
|
52
54
|
|
53
55
|
context "when 2 messages do not have same attribute values" do
|
54
56
|
it "should return false" do
|
55
|
-
expect(message).not_to eq(
|
57
|
+
expect(message).not_to eq(described_class.new(subject: 'random_test', body: 'test_handler'))
|
56
58
|
end
|
57
59
|
end
|
58
60
|
end
|
@@ -1,8 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
|
3
5
|
describe DispatchRider::NotificationServices::Base do
|
4
6
|
subject do
|
5
|
-
|
7
|
+
described_class.new(topics: {})
|
6
8
|
end
|
7
9
|
|
8
10
|
let :channel do
|
@@ -15,7 +17,7 @@ describe DispatchRider::NotificationServices::Base do
|
|
15
17
|
channel
|
16
18
|
end
|
17
19
|
|
18
|
-
before
|
20
|
+
before do
|
19
21
|
allow_any_instance_of(described_class).to receive(:notifier_builder).and_return(OpenStruct)
|
20
22
|
channel = DispatchRider::Registrars::SnsChannel
|
21
23
|
allow_any_instance_of(described_class).to receive(:channel_registrar_builder).and_return(channel)
|
@@ -35,7 +37,7 @@ describe DispatchRider::NotificationServices::Base do
|
|
35
37
|
end
|
36
38
|
|
37
39
|
describe "#publish" do
|
38
|
-
before
|
40
|
+
before do
|
39
41
|
subject.register(:foo, account: 123, region: "us-east-1", topic: "PlanOfAttack")
|
40
42
|
subject.notifier.topics['arn:aws:sns:us-east-1:123:PlanOfAttack'] = channel
|
41
43
|
end
|
@@ -70,7 +72,7 @@ describe DispatchRider::NotificationServices::Base do
|
|
70
72
|
end
|
71
73
|
|
72
74
|
describe "#channels" do
|
73
|
-
before
|
75
|
+
before do
|
74
76
|
subject.register(:foo, account: 123, region: "us-east-1", topic: "PlanOfAttack")
|
75
77
|
subject.notifier.topics['arn:aws:sns:us-east-1:123:PlanOfAttack'] = channel
|
76
78
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
|
3
5
|
describe DispatchRider::Publisher::ConfigurationReader do
|
@@ -126,7 +128,7 @@ describe DispatchRider::Publisher::ConfigurationReader do
|
|
126
128
|
|
127
129
|
it "should call register_destination with the right parameters" do
|
128
130
|
params = ["out1", :file_system, :foo, "path" => "tmp/test/channel"]
|
129
|
-
expect(publisher).to receive(:register_destination).
|
131
|
+
expect(publisher).to receive(:register_destination).once.with(*params)
|
130
132
|
subject.load_config(configuration, publisher)
|
131
133
|
end
|
132
134
|
|