|
9 | 9 | let(:arguments) { { type: event, app_id: "some_group.some_app", message_id: "uuid" } }
|
10 | 10 | let(:event) { "some_successful_event" }
|
11 | 11 | let(:job_class) { Rabbit::Receiving::Job }
|
12 |
| - let(:job_configs) { {} } |
| 12 | + let(:job_configs) { {} } |
13 | 13 | let(:conversion) { false }
|
14 | 14 | let(:handler) { Rabbit::Handler::SomeGroup::SomeSuccessfulEvent }
|
15 | 15 | let(:before_hook) { double("before hook") }
|
@@ -53,7 +53,7 @@ def expect_hooks_to_be_called
|
53 | 53 | Rabbit.config.before_receiving_hooks = [before_hook]
|
54 | 54 | Rabbit.config.after_receiving_hooks = [after_hook]
|
55 | 55 |
|
56 |
| - allow(job_class).to receive(:set).with(queue: queue).and_call_original |
| 56 | + allow(job_class).to receive(:set).with(queue: queue, **job_configs).and_call_original |
57 | 57 |
|
58 | 58 | allow(before_hook).to receive(:call).with(message, message_info)
|
59 | 59 | allow(after_hook).to receive(:call).with(message, message_info)
|
@@ -135,6 +135,17 @@ def call; end
|
135 | 135 | run_receive
|
136 | 136 | end
|
137 | 137 |
|
| 138 | + context "custom job configuration" do |
| 139 | + let(:job_configs) { Hash[some: :kek, pek: 123] } |
| 140 | + |
| 141 | + before { handler.additional_job_configs = job_configs } |
| 142 | + after { handler.additional_job_configs = {} } |
| 143 | + |
| 144 | + it "invokes job with custom config" do |
| 145 | + run_receive |
| 146 | + end |
| 147 | + end |
| 148 | + |
138 | 149 | context "job performs unsuccessfully" do
|
139 | 150 | let(:event) { "some_unsuccessful_event" }
|
140 | 151 | let(:queue) { "custom_prepared" }
|
@@ -238,19 +249,6 @@ def call; end
|
238 | 249 | end
|
239 | 250 | end
|
240 | 251 |
|
241 |
| - context "custom job configuration" do |
242 |
| - let(:queue) { "custom_queue" } |
243 |
| - let(:job_configs) { Hash[some: :kek, pek: 123] } |
244 |
| - let(:handler) { Rabbit::Handler::SomeGroup::SomeConfigurableEventHandler } |
245 |
| - |
246 |
| - before { handler.job_configs(job_configs) } |
247 |
| - after { handler.job_configs({}) } |
248 |
| - |
249 |
| - it "invokes job with custom config" do |
250 |
| - run_receive |
251 |
| - end |
252 |
| - end |
253 |
| - |
254 | 252 | context "custom receiving job" do
|
255 | 253 | let(:custom_job_class) { class_double("CustomJobClass") }
|
256 | 254 | let(:custom_job) { double("CustomJob") }
|
|
0 commit comments