File tree Expand file tree Collapse file tree 3 files changed +14
-5
lines changed Expand file tree Collapse file tree 3 files changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -15,8 +15,6 @@ class Rabbit::EventHandler
15
15
class_attribute :additional_job_configs , default : { }
16
16
17
17
class << self
18
- private
19
-
20
18
def queue_as ( queue = nil , &block )
21
19
self . queue = queue || block
22
20
end
@@ -25,7 +23,7 @@ def job_config(**config_opts)
25
23
additional_job_configs . merge! ( config_opts )
26
24
end
27
25
28
- def job_configs ( ** config_opts )
26
+ def job_configs ( config_opts )
29
27
self . additional_job_configs = config_opts
30
28
end
31
29
end
Original file line number Diff line number Diff line change @@ -14,6 +14,14 @@ class SomeSuccessfulEvent < Rabbit::EventHandler
14
14
def call ; end
15
15
end
16
16
17
+ class SomeConfigurableEventHandler < Rabbit ::EventHandler
18
+ queue_as { |message , arguments | "#{ message . data [ :hello ] } _#{ arguments [ :type ] } " }
19
+
20
+ attribute :hello
21
+
22
+ def call ; end
23
+ end
24
+
17
25
class SomeUnsuccessfulEvent < Rabbit ::EventHandler
18
26
queue_as :custom
19
27
Original file line number Diff line number Diff line change @@ -239,14 +239,17 @@ def call; end
239
239
end
240
240
241
241
context "custom job configuration" do
242
- let ( :queue ) { "custom_queue" }
243
242
let ( :job_configs ) { Hash [ some : :kek , pek : 123 ] }
244
- let ( :handler ) { Rabbit ::Handler ::SomeGroup ::SomeConfigurableEventHandler }
243
+ let ( :handler ) { Rabbit ::Handler ::SomeGroup ::SomeConfigurableEventHandler }
244
+ let ( :queue ) { "world_some_successful_event_prepared" }
245
245
246
246
before { handler . job_configs ( job_configs ) }
247
247
after { handler . job_configs ( { } ) }
248
248
249
249
it "invokes job with custom config" do
250
+ expect_job_queue_to_be_set
251
+ expect_empty_handler_to_be_called
252
+ expect_hooks_to_be_called
250
253
run_receive
251
254
end
252
255
end
You can’t perform that action at this time.
0 commit comments