Sha256: 22469ca929a81f299678f187527f09ee043e76de98f883dd861f94efa66e571a

Contents?: true

Size: 750 Bytes

Versions: 4

Compression:

Stored size: 750 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

describe TTY::Terminal::SystemPager, '#simple' do
  let(:input)    { StringIO.new }
  let(:output)   { StringIO.new }
  let(:shell)    { TTY::Shell.new(input, output) }
  let(:terminal) { TTY.terminal }
  let(:object)   { described_class }

  subject(:pager) { object.new(text) }

  before {
    allow(TTY).to receive(:shell).and_return(shell)
    allow(IO).to receive(:pipe).and_return([input, output])
    allow(Kernel).to receive(:fork) { true }
  }

  context 'when text fits on screen' do
    let(:text) { "a\na\na\na\na\na\na\na\na\na\n" }

    it "doesn't page text not long enough" do
      expect(Kernel).to receive(:exec)
      expect(Kernel).to receive(:select)
      pager.page
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
tty-0.1.3 spec/tty/terminal/pager/system/page_spec.rb
tty-0.1.2 spec/tty/terminal/pager/system/page_spec.rb
tty-0.1.1 spec/tty/terminal/pager/system/page_spec.rb
tty-0.1.0 spec/tty/terminal/pager/system/page_spec.rb