This repository was archived by the owner on Nov 30, 2024. It is now read-only.
File tree 2 files changed +14
-6
lines changed
2 files changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -75,12 +75,20 @@ def fail_fast(reporter, exception)
75
75
finish ( reporter )
76
76
end
77
77
78
- class Procsy < Proc
78
+ def self . procsy ( metadata , &block )
79
+ Proc . new ( &block ) . extend ( Procsy ) . with ( metadata )
80
+ end
81
+
82
+ module Procsy
79
83
attr_reader :metadata
80
- alias_method :run , :call
81
- def initialize ( metadata , &block )
84
+
85
+ def self . extended ( object )
86
+ def object . run ; call ; end
87
+ end
88
+
89
+ def with ( metadata )
82
90
@metadata = metadata
83
- super ( & block )
91
+ self
84
92
end
85
93
end
86
94
@@ -97,7 +105,7 @@ def with_around_hooks(&block)
97
105
if around_hooks . empty?
98
106
yield
99
107
else
100
- @example_group_class . eval_around_eachs ( self , Procsy . new ( metadata , &block ) ) . call
108
+ @example_group_class . eval_around_eachs ( self , Example . procsy ( metadata , &block ) ) . call
101
109
end
102
110
end
103
111
Original file line number Diff line number Diff line change @@ -180,7 +180,7 @@ def self.eval_before_alls(example_group_instance)
180
180
181
181
def self . eval_around_eachs ( example , initial_procsy )
182
182
example . around_hooks . reverse . inject ( initial_procsy ) do |procsy , around_hook |
183
- Example :: Procsy . new ( procsy . metadata ) do
183
+ Example . procsy ( procsy . metadata ) do
184
184
example . example_group_instance . instance_eval_with_args ( procsy , &around_hook )
185
185
end
186
186
end
You can’t perform that action at this time.
0 commit comments