summaryrefslogtreecommitdiff
path: root/spec/ruby/core/proc/compose_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/core/proc/compose_spec.rb')
-rw-r--r--spec/ruby/core/proc/compose_spec.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/ruby/core/proc/compose_spec.rb b/spec/ruby/core/proc/compose_spec.rb
index f1befe658b..35e949a779 100644
--- a/spec/ruby/core/proc/compose_spec.rb
+++ b/spec/ruby/core/proc/compose_spec.rb
@@ -44,6 +44,14 @@ ruby_version_is "2.6" do
(inc << mul).call(2, 3).should == 7
end
+
+ it "passes blocks to the second proc" do
+ ScratchPad.record []
+ one = proc { |&arg| arg.call :one if arg }
+ two = proc { |&arg| arg.call :two if arg }
+ (one << two).call { |x| ScratchPad << x }
+ ScratchPad.recorded.should == [:two]
+ end
end
end
@@ -89,6 +97,14 @@ ruby_version_is "2.6" do
(mul >> inc).call(2, 3).should == 7
end
+
+ it "passes blocks to the first proc" do
+ ScratchPad.record []
+ one = proc { |&arg| arg.call :one if arg }
+ two = proc { |&arg| arg.call :two if arg }
+ (one >> two).call { |x| ScratchPad << x }
+ ScratchPad.recorded.should == [:one]
+ end
end
end
end