dispatch-rider 1.5.3 → 1.6.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/Gemfile +2 -2
- data/lib/dispatch-rider.rb +1 -0
- data/lib/dispatch-rider/configuration.rb +12 -5
- data/lib/dispatch-rider/demultiplexer.rb +3 -27
- data/lib/dispatch-rider/logging.rb +10 -0
- data/lib/dispatch-rider/logging/base_formatter.rb +30 -0
- data/lib/dispatch-rider/logging/json_formatter.rb +75 -0
- data/lib/dispatch-rider/logging/lifecycle_logger.rb +53 -0
- data/lib/dispatch-rider/logging/text_formatter.rb +48 -0
- data/lib/dispatch-rider/queue_services/file_system/queue.rb +13 -2
- data/lib/dispatch-rider/version.rb +1 -1
- data/spec/lib/dispatch-rider/airbrake_error_handler_spec.rb +10 -3
- data/spec/lib/dispatch-rider/callbacks/access_spec.rb +16 -18
- data/spec/lib/dispatch-rider/callbacks/storage_spec.rb +4 -9
- data/spec/lib/dispatch-rider/configuration_spec.rb +3 -3
- data/spec/lib/dispatch-rider/default_error_handler_spec.rb +2 -2
- data/spec/lib/dispatch-rider/demultiplexer_spec.rb +14 -14
- data/spec/lib/dispatch-rider/dispatcher_spec.rb +10 -8
- data/spec/lib/dispatch-rider/handlers/base_spec.rb +27 -22
- data/spec/lib/dispatch-rider/handlers/inheritance_tracking_spec.rb +6 -6
- data/spec/lib/dispatch-rider/logging/json_formatter_spec.rb +72 -0
- data/spec/lib/dispatch-rider/logging/lifecycle_logger_spec.rb +73 -0
- data/spec/lib/dispatch-rider/logging/text_formatter_spec.rb +61 -0
- data/spec/lib/dispatch-rider/message_spec.rb +11 -11
- data/spec/lib/dispatch-rider/notification_services/aws_sns_spec.rb +14 -13
- data/spec/lib/dispatch-rider/notification_services/base_spec.rb +18 -13
- data/spec/lib/dispatch-rider/notification_services/file_system/channel_spec.rb +2 -3
- data/spec/lib/dispatch-rider/notification_services/file_system/notifier_spec.rb +1 -3
- data/spec/lib/dispatch-rider/notification_services/file_system_spec.rb +3 -4
- data/spec/lib/dispatch-rider/publisher/configuration/destination_spec.rb +30 -21
- data/spec/lib/dispatch-rider/publisher/configuration/notification_service_spec.rb +22 -16
- data/spec/lib/dispatch-rider/publisher/configuration_reader_spec.rb +11 -10
- data/spec/lib/dispatch-rider/publisher/configuration_spec.rb +12 -12
- data/spec/lib/dispatch-rider/publisher/configuration_support_spec.rb +11 -11
- data/spec/lib/dispatch-rider/publisher_spec.rb +22 -15
- data/spec/lib/dispatch-rider/queue_services/aws_sqs_spec.rb +44 -36
- data/spec/lib/dispatch-rider/queue_services/base_spec.rb +41 -28
- data/spec/lib/dispatch-rider/queue_services/file_system_spec.rb +15 -14
- data/spec/lib/dispatch-rider/queue_services/received_message_spec.rb +3 -3
- data/spec/lib/dispatch-rider/queue_services/simple_spec.rb +9 -9
- data/spec/lib/dispatch-rider/registrars/base_spec.rb +5 -5
- data/spec/lib/dispatch-rider/registrars/file_system_channel_spec.rb +3 -3
- data/spec/lib/dispatch-rider/registrars/handler_spec.rb +1 -1
- data/spec/lib/dispatch-rider/registrars/notification_service_spec.rb +1 -1
- data/spec/lib/dispatch-rider/registrars/publishing_destination_spec.rb +2 -2
- data/spec/lib/dispatch-rider/registrars/queue_service_spec.rb +1 -1
- data/spec/lib/dispatch-rider/registrars/sns_channel_spec.rb +5 -5
- data/spec/lib/dispatch-rider/runner_spec.rb +1 -1
- data/spec/lib/dispatch-rider/subscriber_spec.rb +45 -29
- data/spec/lib/dispatch-rider_spec.rb +3 -3
- data/spec/spec_helper.rb +3 -1
- metadata +13 -2
@@ -0,0 +1,61 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe DispatchRider::Logging::TextFormatter do
|
4
|
+
let(:fs_message) { DispatchRider::Message.new(subject: 'test', body: { 'key' => 'value', 'guid' => 123 }) }
|
5
|
+
let(:item) { double :item }
|
6
|
+
let(:queue) { double :queue }
|
7
|
+
let(:message) { DispatchRider::QueueServices::FileSystem::FsReceivedMessage.new(fs_message, item, queue) }
|
8
|
+
|
9
|
+
let(:string_to_log) { "string to log" }
|
10
|
+
let(:exception) { StandardError.new }
|
11
|
+
let(:reason) { "Stop reason" }
|
12
|
+
|
13
|
+
before do
|
14
|
+
allow(subject).to receive(:message_info_fragment).and_return(string_to_log)
|
15
|
+
allow(subject).to receive(:exception_info_fragment).and_return(string_to_log)
|
16
|
+
end
|
17
|
+
|
18
|
+
context "format_error_handler_fail" do
|
19
|
+
let(:formatted_message) { "Failed error handling of: string to log" }
|
20
|
+
example do
|
21
|
+
expect(subject.format_error_handler_fail(message, exception)).to eq(formatted_message)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
context "format_got_stop" do
|
26
|
+
let(:formatted_message) { "Got stop (Stop reason) while executing: string to log" }
|
27
|
+
example do
|
28
|
+
expect(subject.format_got_stop(message, reason)).to eq(formatted_message)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
context "format_handling" do
|
33
|
+
context "start" do
|
34
|
+
let(:formatted_message) { "Starting execution of: string to log" }
|
35
|
+
example do
|
36
|
+
expect(subject.format_handling(:start, message)).to eq(formatted_message)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
context "success" do
|
41
|
+
let(:formatted_message) { "Succeeded execution of: string to log" }
|
42
|
+
example do
|
43
|
+
expect(subject.format_handling(:success, message)).to eq(formatted_message)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
context "complete" do
|
48
|
+
let(:formatted_message) { "Completed execution of: string to log in 2.12 seconds" }
|
49
|
+
example do
|
50
|
+
expect(subject.format_handling(:complete, message, duration: 2.12)).to eq(formatted_message)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
context "fail" do
|
55
|
+
let(:formatted_message) { "Failed execution of: string to log" }
|
56
|
+
example do
|
57
|
+
expect(subject.format_handling(:fail, message, exception: exception)).to eq(formatted_message)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -1,23 +1,23 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe DispatchRider::Message do
|
4
|
-
subject(:message) {DispatchRider::Message.new(:
|
4
|
+
subject(:message) { DispatchRider::Message.new(subject: 'test', body: 'test_handler') }
|
5
5
|
|
6
6
|
describe "#initialize" do
|
7
7
|
context "when all the required attributes are passed" do
|
8
8
|
context "when the attributes hash has keys as strings" do
|
9
|
-
subject(:message) {DispatchRider::Message.new('subject' => 'test', 'body' => 'test_handler')}
|
9
|
+
subject(:message) { DispatchRider::Message.new('subject' => 'test', 'body' => 'test_handler') }
|
10
10
|
|
11
11
|
it "should initiate a new message" do
|
12
|
-
message.subject.
|
13
|
-
message.body.
|
12
|
+
expect(message.subject).to eq('test')
|
13
|
+
expect(message.body).to eq('test_handler')
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
17
|
context "when the attributes hash has keys as symbols" do
|
18
18
|
it "should initiate a new message" do
|
19
|
-
message.subject.
|
20
|
-
message.body.
|
19
|
+
expect(message.subject).to eq('test')
|
20
|
+
expect(message.body).to eq('test_handler')
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
@@ -31,28 +31,28 @@ describe DispatchRider::Message do
|
|
31
31
|
|
32
32
|
describe "#attributes" do
|
33
33
|
it "should return the attributes hash of the message" do
|
34
|
-
message.attributes.
|
34
|
+
expect(message.attributes).to eq(subject: 'test', body: 'test_handler')
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
38
|
describe "#to_json" do
|
39
39
|
it "should return the attributes hash in json format" do
|
40
40
|
result = JSON.parse(message.to_json)
|
41
|
-
result['subject'].
|
42
|
-
result['body'].
|
41
|
+
expect(result['subject']).to eq('test')
|
42
|
+
expect(result['body']).to eq('test_handler')
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
46
|
describe "#==" do
|
47
47
|
context "when 2 messages have the same attribute values" do
|
48
48
|
it "should return true" do
|
49
|
-
message.
|
49
|
+
expect(message).to eq(DispatchRider::Message.new(subject: 'test', body: 'test_handler'))
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
53
53
|
context "when 2 messages do not have same attribute values" do
|
54
54
|
it "should return false" do
|
55
|
-
message.
|
55
|
+
expect(message).not_to eq(DispatchRider::Message.new(subject: 'random_test', body: 'test_handler'))
|
56
56
|
end
|
57
57
|
end
|
58
58
|
end
|
@@ -1,17 +1,17 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe DispatchRider::NotificationServices::AwsSns do
|
4
|
-
let(:amazon_resource_name){ "arn:aws:sns:us-west-2:123456789012:GeneralTopic" }
|
4
|
+
let(:amazon_resource_name) { "arn:aws:sns:us-west-2:123456789012:GeneralTopic" }
|
5
5
|
|
6
6
|
describe "#notifier_builder" do
|
7
7
|
it "returns the notifier builder" do
|
8
|
-
subject.notifier_builder.
|
8
|
+
expect(subject.notifier_builder).to eq(AWS::SNS)
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
12
12
|
describe "#channel_registrar_builder" do
|
13
13
|
it "returns the channel registrar builder" do
|
14
|
-
subject.channel_registrar_builder.
|
14
|
+
expect(subject.channel_registrar_builder).to eq(DispatchRider::Registrars::SnsChannel)
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
@@ -21,25 +21,26 @@ describe DispatchRider::NotificationServices::AwsSns do
|
|
21
21
|
|
22
22
|
# @note: This is tested this way cause you don't really wanna post a message to the actual service.
|
23
23
|
it "publishes the message to the channels" do
|
24
|
-
expect(channel).to receive(:publish).with(kind_of String)
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
24
|
+
expect(channel).to receive(:publish).with(kind_of String) do |serialized_message|
|
25
|
+
expected = {
|
26
|
+
"subject" => "test_handler",
|
27
|
+
"body" => { "bar" => "baz" }
|
28
|
+
}
|
29
|
+
expect(JSON.parse(serialized_message)).to eq(expected)
|
30
|
+
end
|
30
31
|
|
31
32
|
subject.publish_to_channel(channel, message: message)
|
32
33
|
end
|
33
34
|
end
|
34
35
|
|
35
36
|
describe "#channel" do
|
36
|
-
before { subject.
|
37
|
+
before { allow(subject).to receive(:channel_registrar).and_return(foo: amazon_resource_name) }
|
37
38
|
|
38
|
-
let(:topics){ double :sns_topics }
|
39
|
-
let(:topic){ double :sns_topic }
|
39
|
+
let(:topics) { double :sns_topics }
|
40
|
+
let(:topic) { double :sns_topic }
|
40
41
|
|
41
42
|
it "returns the channel" do
|
42
|
-
subject.channel(:foo).arn.
|
43
|
+
expect(subject.channel(:foo).arn).to eq(amazon_resource_name)
|
43
44
|
end
|
44
45
|
end
|
45
46
|
end
|
@@ -12,24 +12,25 @@ describe DispatchRider::NotificationServices::Base do
|
|
12
12
|
end
|
13
13
|
|
14
14
|
before :each do
|
15
|
-
|
16
|
-
DispatchRider::
|
17
|
-
|
15
|
+
allow_any_instance_of(described_class).to receive(:notifier_builder).and_return(OpenStruct)
|
16
|
+
channel = DispatchRider::Registrars::SnsChannel
|
17
|
+
allow_any_instance_of(described_class).to receive(:channel_registrar_builder).and_return(channel)
|
18
|
+
allow_any_instance_of(described_class).to receive(:channel) do |name|
|
18
19
|
subject.notifier.topics[subject.fetch(name)] if name == :foo
|
19
20
|
end
|
20
21
|
end
|
21
22
|
|
22
23
|
subject do
|
23
|
-
DispatchRider::NotificationServices::Base.new(
|
24
|
+
DispatchRider::NotificationServices::Base.new(topics: {})
|
24
25
|
end
|
25
26
|
|
26
27
|
describe "#initialize" do
|
27
28
|
it "assigns the notifier" do
|
28
|
-
subject.notifier.
|
29
|
+
expect(subject.notifier).to respond_to(:topics)
|
29
30
|
end
|
30
31
|
|
31
32
|
it "assigns the channel registrar" do
|
32
|
-
subject.channel_registrar.store.
|
33
|
+
expect(subject.channel_registrar.store).to be_empty
|
33
34
|
end
|
34
35
|
end
|
35
36
|
|
@@ -42,7 +43,7 @@ describe DispatchRider::NotificationServices::Base do
|
|
42
43
|
let(:message) { DispatchRider::Message.new(subject: :test_handler, body: { "bar" => "baz" }) }
|
43
44
|
|
44
45
|
it "publishes the message to the channels" do
|
45
|
-
catch(:published) { subject.publish to: :foo, message: message }.
|
46
|
+
expect(catch(:published) { subject.publish to: :foo, message: message }).to eq("baz")
|
46
47
|
end
|
47
48
|
end
|
48
49
|
|
@@ -50,15 +51,19 @@ describe DispatchRider::NotificationServices::Base do
|
|
50
51
|
let(:channel) { double(:channel) }
|
51
52
|
|
52
53
|
let(:message) { DispatchRider::Message.new(subject: :test_handler, body: { "bar" => "baz" }) }
|
54
|
+
let(:expected_message) do
|
55
|
+
{
|
56
|
+
"subject" => "test_handler",
|
57
|
+
"body" => { "bar" => "baz" }
|
58
|
+
}
|
59
|
+
end
|
53
60
|
|
54
61
|
# @note: This is tested this way cause you don't really wanna post a message to the actual service.
|
55
62
|
it "publishes the message to the channels" do
|
56
63
|
expect(channel).to receive(:publish).with(kind_of String) { |serialized_message|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
)
|
61
|
-
}
|
64
|
+
parsed_message = JSON.parse(serialized_message)
|
65
|
+
expect(parsed_message).to eq(expected_message)
|
66
|
+
}
|
62
67
|
|
63
68
|
subject.publish_to_channel(channel, message: message)
|
64
69
|
end
|
@@ -71,7 +76,7 @@ describe DispatchRider::NotificationServices::Base do
|
|
71
76
|
end
|
72
77
|
|
73
78
|
it "returns an array of channels" do
|
74
|
-
subject.channels(:foo).
|
79
|
+
expect(subject.channels(:foo)).to eq([channel])
|
75
80
|
end
|
76
81
|
end
|
77
82
|
end
|
@@ -1,7 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe DispatchRider::NotificationServices::FileSystem::Channel do
|
4
|
-
|
5
4
|
let(:path) { File.expand_path("tmp/test/channel") }
|
6
5
|
let(:published_message) { File.new(Dir["#{path}/*.ready"].first).read }
|
7
6
|
|
@@ -11,7 +10,7 @@ describe DispatchRider::NotificationServices::FileSystem::Channel do
|
|
11
10
|
subject { described_class.new(path) }
|
12
11
|
|
13
12
|
describe "#publish" do
|
14
|
-
let(:message){ {:
|
13
|
+
let(:message) { { subject: "foo", body: "bar" }.to_json }
|
15
14
|
|
16
15
|
it "adds a file to the path folder" do
|
17
16
|
expect {
|
@@ -22,7 +21,7 @@ describe DispatchRider::NotificationServices::FileSystem::Channel do
|
|
22
21
|
it "writes the message to the file" do
|
23
22
|
subject.publish(message)
|
24
23
|
|
25
|
-
published_message.
|
24
|
+
expect(published_message).to eq(message)
|
26
25
|
end
|
27
26
|
end
|
28
27
|
end
|
@@ -1,14 +1,12 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe DispatchRider::NotificationServices::FileSystem::Notifier do
|
4
|
-
|
5
4
|
subject { described_class.new({}) }
|
6
5
|
|
7
6
|
describe "#channel" do
|
8
7
|
it "returns a channel object" do
|
9
|
-
subject.channel("tmp/some/path").
|
8
|
+
expect(subject.channel("tmp/some/path")).to be_a(DispatchRider::NotificationServices::FileSystem::Channel)
|
10
9
|
end
|
11
10
|
end
|
12
|
-
|
13
11
|
end
|
14
12
|
|
@@ -1,23 +1,22 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe DispatchRider::NotificationServices::FileSystem do
|
4
|
-
|
5
4
|
describe "#notifier_builder" do
|
6
5
|
it "returns the notifier builder" do
|
7
|
-
subject.notifier_builder.
|
6
|
+
expect(subject.notifier_builder).to eq(DispatchRider::NotificationServices::FileSystem::Notifier)
|
8
7
|
end
|
9
8
|
end
|
10
9
|
|
11
10
|
describe "#channel_registrar_builder" do
|
12
11
|
it "returns the channel registrar builder" do
|
13
|
-
subject.channel_registrar_builder.
|
12
|
+
expect(subject.channel_registrar_builder).to eq(DispatchRider::Registrars::FileSystemChannel)
|
14
13
|
end
|
15
14
|
end
|
16
15
|
|
17
16
|
describe "#channel" do
|
18
17
|
it "returns the channel" do
|
19
18
|
subject.channel_registrar.register(:foo, :path => "tmp/test/channel")
|
20
|
-
subject.channel(:foo).
|
19
|
+
expect(subject.channel(:foo)).to be_a(DispatchRider::NotificationServices::FileSystem::Channel)
|
21
20
|
end
|
22
21
|
end
|
23
22
|
end
|
@@ -1,8 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
-
require 'rspec/its'
|
3
2
|
|
4
3
|
describe DispatchRider::Publisher::Configuration::Destination do
|
5
|
-
|
6
4
|
let(:attributes) do
|
7
5
|
{
|
8
6
|
"service" => "aws_sns",
|
@@ -19,43 +17,55 @@ describe DispatchRider::Publisher::Configuration::Destination do
|
|
19
17
|
}
|
20
18
|
end
|
21
19
|
|
22
|
-
subject{ described_class.new("employee", attributes) }
|
20
|
+
subject { described_class.new("employee", attributes) }
|
23
21
|
|
24
22
|
describe "#name" do
|
25
|
-
|
23
|
+
describe '#name' do
|
24
|
+
subject { super().name }
|
25
|
+
it { is_expected.to eq("employee") }
|
26
|
+
end
|
26
27
|
end
|
27
28
|
|
28
29
|
describe "#service" do
|
29
|
-
|
30
|
+
describe '#service' do
|
31
|
+
subject { super().service }
|
32
|
+
it { is_expected.to eq("aws_sns") }
|
33
|
+
end
|
30
34
|
end
|
31
35
|
|
32
36
|
describe "#channel" do
|
33
|
-
|
37
|
+
describe '#channel' do
|
38
|
+
subject { super().channel }
|
39
|
+
it { is_expected.to eq("employee_updates") }
|
40
|
+
end
|
34
41
|
end
|
35
42
|
|
36
43
|
describe "#options" do
|
37
|
-
|
44
|
+
describe '#options' do
|
45
|
+
subject { super().options }
|
46
|
+
it { is_expected.to eq(options) }
|
47
|
+
end
|
38
48
|
end
|
39
49
|
|
40
50
|
describe "#==" do
|
41
|
-
let(:other){ described_class.new(name, other_attributes) }
|
51
|
+
let(:other) { described_class.new(name, other_attributes) }
|
42
52
|
|
43
53
|
context "when the destinations' name, service, channel and options are the same" do
|
44
|
-
let(:name){ subject.name }
|
45
|
-
let(:other_attributes){ attributes }
|
54
|
+
let(:name) { subject.name }
|
55
|
+
let(:other_attributes) { attributes }
|
46
56
|
|
47
|
-
it{
|
57
|
+
it { is_expected.to eq other }
|
48
58
|
end
|
49
59
|
|
50
60
|
context "when the destinations' name is different" do
|
51
|
-
let(:name){ "account" }
|
52
|
-
let(:other_attributes){ attributes }
|
61
|
+
let(:name) { "account" }
|
62
|
+
let(:other_attributes) { attributes }
|
53
63
|
|
54
|
-
it{
|
64
|
+
it { is_expected.not_to eq other }
|
55
65
|
end
|
56
66
|
|
57
67
|
context "when the destinations' service is different" do
|
58
|
-
let(:name){ subject.name }
|
68
|
+
let(:name) { subject.name }
|
59
69
|
|
60
70
|
let(:other_attributes) do
|
61
71
|
{
|
@@ -65,11 +75,11 @@ describe DispatchRider::Publisher::Configuration::Destination do
|
|
65
75
|
}
|
66
76
|
end
|
67
77
|
|
68
|
-
it{
|
78
|
+
it { is_expected.not_to eq other }
|
69
79
|
end
|
70
80
|
|
71
81
|
context "when the destinations' channel is different" do
|
72
|
-
let(:name){ subject.name }
|
82
|
+
let(:name) { subject.name }
|
73
83
|
|
74
84
|
let(:other_attributes) do
|
75
85
|
{
|
@@ -79,11 +89,11 @@ describe DispatchRider::Publisher::Configuration::Destination do
|
|
79
89
|
}
|
80
90
|
end
|
81
91
|
|
82
|
-
it{
|
92
|
+
it { is_expected.not_to eq other }
|
83
93
|
end
|
84
94
|
|
85
95
|
context "when the destinations' options are different" do
|
86
|
-
let(:name){ subject.name }
|
96
|
+
let(:name) { subject.name }
|
87
97
|
|
88
98
|
let(:other_attributes) do
|
89
99
|
{
|
@@ -93,8 +103,7 @@ describe DispatchRider::Publisher::Configuration::Destination do
|
|
93
103
|
}
|
94
104
|
end
|
95
105
|
|
96
|
-
it{
|
106
|
+
it { is_expected.not_to eq other }
|
97
107
|
end
|
98
108
|
end
|
99
|
-
|
100
109
|
end
|
@@ -8,45 +8,51 @@ describe DispatchRider::Publisher::Configuration::NotificationService do
|
|
8
8
|
}
|
9
9
|
end
|
10
10
|
|
11
|
-
subject{ described_class.new("file_system", options) }
|
11
|
+
subject { described_class.new("file_system", options) }
|
12
12
|
|
13
13
|
describe "#name" do
|
14
|
-
|
14
|
+
describe '#name' do
|
15
|
+
subject { super().name }
|
16
|
+
it { is_expected.to eq("file_system") }
|
17
|
+
end
|
15
18
|
end
|
16
19
|
|
17
20
|
describe "#options" do
|
18
|
-
|
21
|
+
describe '#options' do
|
22
|
+
subject { super().options }
|
23
|
+
it { is_expected.to eq(options) }
|
24
|
+
end
|
19
25
|
end
|
20
26
|
|
21
27
|
describe "#==" do
|
22
|
-
let(:other){ described_class.new(name, other_options) }
|
28
|
+
let(:other) { described_class.new(name, other_options) }
|
23
29
|
|
24
30
|
context "two notification services with the same name and options" do
|
25
|
-
let(:name){ subject.name }
|
26
|
-
let(:other_options){ options }
|
31
|
+
let(:name) { subject.name }
|
32
|
+
let(:other_options) { options }
|
27
33
|
|
28
|
-
it{
|
34
|
+
it { is_expected.to eq other }
|
29
35
|
end
|
30
36
|
|
31
37
|
context "two notification services with different names but the same options" do
|
32
|
-
let(:name){ "aws_sns" }
|
33
|
-
let(:other_options){ options }
|
38
|
+
let(:name) { "aws_sns" }
|
39
|
+
let(:other_options) { options }
|
34
40
|
|
35
|
-
it{
|
41
|
+
it { is_expected.not_to eq other }
|
36
42
|
end
|
37
43
|
|
38
44
|
context "two notificaiton services with the same name but different options" do
|
39
|
-
let(:name){ subject.name }
|
40
|
-
let(:other_options){ { "topic" => "employee_updates" } }
|
45
|
+
let(:name) { subject.name }
|
46
|
+
let(:other_options) { { "topic" => "employee_updates" } }
|
41
47
|
|
42
|
-
it{
|
48
|
+
it { is_expected.not_to eq other }
|
43
49
|
end
|
44
50
|
|
45
51
|
context "two notification services with different names and options" do
|
46
|
-
let(:name){ "aws_sns" }
|
47
|
-
let(:other_options){ { "topic" => "employee_updates" } }
|
52
|
+
let(:name) { "aws_sns" }
|
53
|
+
let(:other_options) { { "topic" => "employee_updates" } }
|
48
54
|
|
49
|
-
it{
|
55
|
+
it { is_expected.not_to eq other }
|
50
56
|
end
|
51
57
|
end
|
52
58
|
|