Commit cb905b5 1 parent eb9d721 commit cb905b5 Copy full SHA for cb905b5
File tree 3 files changed +17
-3
lines changed
3 files changed +17
-3
lines changed Original file line number Diff line number Diff line change 5
5
module Resol
6
6
module Plugins
7
7
PLUGINS_PATH = Pathname ( "resol/plugins" )
8
+
8
9
class Manager
9
10
def self . resolve_module ( module_name )
10
11
Plugins . const_get ( module_name )
Original file line number Diff line number Diff line change @@ -47,13 +47,13 @@ def plugin(...)
47
47
manager . plugin ( self , ...)
48
48
end
49
49
50
- def call ( ... )
51
- service = build ( ... )
50
+ def call ( * args , ** kwargs , & )
51
+ service = build ( * args , ** kwargs )
52
52
53
53
result = handle_catch ( service ) do
54
54
service . instance_variable_set ( :@__performing__ , true )
55
55
__run_callbacks__ ( service )
56
- service . call
56
+ service . call ( & )
57
57
end
58
58
return Resol ::Success ( result . data ) if service . __result_method__called__
59
59
Original file line number Diff line number Diff line change @@ -99,6 +99,12 @@ def call
99
99
end
100
100
end
101
101
102
+ class YieldingService < SmartService
103
+ def call
104
+ success! ( yield )
105
+ end
106
+ end
107
+
102
108
class PluginSuccessService < ReturnEngineService
103
109
def call
104
110
success! ( :success_result )
@@ -243,6 +249,13 @@ def call
243
249
expect { HackyService . call! ( 0 ) } . to raise_error ( Resol ::Service ::InvalidCommandCall )
244
250
end
245
251
end
252
+
253
+ context "when block passed to the service" do
254
+ it "yields block" do
255
+ result = YieldingService . call! { "kek" }
256
+ expect ( result ) . to eq ( "kek" )
257
+ end
258
+ end
246
259
end
247
260
248
261
context "with Return on success plugin" do
You can’t perform that action at this time.
0 commit comments