spec/unit/system/page_spec.rb in tty-pager-0.4.0 vs spec/unit/system/page_spec.rb in tty-pager-0.5.0
- old
+ new
@@ -8,12 +8,18 @@
text = "I try all things, I achieve what I can.\n"
pager = described_class.new(output: output, input: input)
read_io = spy
write_io = spy
+ if !pager.respond_to?(:fork)
+ described_class.send :define_method, :fork, lambda { |*args|
+ yield if block_given?
+ }
+ end
+
allow(IO).to receive(:pipe).and_return([read_io, write_io])
- allow(Kernel).to receive(:fork) do |&block|
+ allow(pager).to receive(:fork) do |&block|
allow(input).to receive(:reopen)
allow(IO).to receive(:select)
allow(pager).to receive(:pager_command).and_return('less')
allow(pager).to receive(:exec)
block.call