Skip to content

Commit 61239af

Browse files
author
Marc-Antoine Bourgeot
committed
WIP: fix existing unit tests
1 parent c5af410 commit 61239af

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

spec/inputs/sqs_spec.rb

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,8 @@
110110

111111
# We have to make sure we create a bunch of events
112112
# so we actually really try to stop the plugin.
113-
#
114-
# rspec's `and_yield` allow you to define a fix amount of possible
113+
#
114+
# rspec's `and_yield` allow you to define a fix amount of possible
115115
# yielded values and doesn't allow you to create infinite loop.
116116
# And since we are actually creating thread we need to make sure
117117
# we have enough work to keep the thread working until we kill it..
@@ -140,10 +140,11 @@ def poll(polling_options = {})
140140
let(:id_field) { "my_id_field" }
141141
let(:md5_field) { "my_md5_field" }
142142
let(:sent_timestamp_field) { "my_sent_timestamp_field" }
143+
let(:user_attributes_field) { "my_user_attributes_field" }
143144

144145
let(:message) do
145-
double("message", :message_id => message_id, :md5_of_body => md5_of_body, :attributes => { LogStash::Inputs::SQS::SENT_TIMESTAMP => epoch_timestamp } )
146-
end
146+
double("message", :message_id => message_id, :md5_of_body => md5_of_body, :attributes => { LogStash::Inputs::SQS::SENT_TIMESTAMP => epoch_timestamp }, :user_attributes => user_attributes_field )
147+
end
147148

148149
subject { input.add_sqs_data(event, message) }
149150

@@ -156,7 +157,8 @@ def poll(polling_options = {})
156157
"queue" => queue_name,
157158
"id_field" => id_field,
158159
"md5_field" => md5_field,
159-
"sent_timestamp_field" => sent_timestamp_field
160+
"sent_timestamp_field" => sent_timestamp_field,
161+
"user_attributes_field" => user_attributes_field
160162
}
161163
end
162164

@@ -198,7 +200,7 @@ def poll(polling_options = {})
198200
end
199201

200202
context "receiving messages" do
201-
before do
203+
before do
202204
expect(subject).to receive(:poller).and_return(mock_sqs).at_least(:once)
203205
end
204206

@@ -235,7 +237,7 @@ def poll(polling_options = {})
235237
it "retry to fetch messages" do
236238
# change the poller implementation to raise SQS errors.
237239
had_error = false
238-
240+
239241
# actually using the child of `Object` to do an expectation of `#sleep`
240242
expect(subject).to receive(:sleep).with(LogStash::Inputs::SQS::BACKOFF_SLEEP_TIME)
241243
expect(mock_sqs).to receive(:poll).with(anything()).at_most(2) do

0 commit comments

Comments
 (0)