Skip to content

Commit

Permalink
Add size detection with verbose mode enabled test
Browse files Browse the repository at this point in the history
  • Loading branch information
piotrmurach committed Dec 17, 2023
1 parent 7e42c10 commit 4b5585a
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions spec/unit/screen_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,26 @@
expect(screen).not_to have_received(:size_from_tput)
end

it "falls through with verbose mode enabled to the first detected size" do
size_from_methods = {
size_from_java: nil,
size_from_win_api: nil,
size_from_ioctl: nil,
size_from_io_console: nil,
size_from_readline: [51, 211],
size_from_tput: nil
}
allow(screen).to receive_messages(size_from_methods)

expect(screen.size(verbose: true)).to eq([51, 211])
expect(screen).to have_received(:size_from_java).with(verbose: true)
expect(screen).to have_received(:size_from_win_api).with(verbose: true)
expect(screen).to have_received(:size_from_ioctl)
expect(screen).to have_received(:size_from_io_console).with(verbose: true)
expect(screen).to have_received(:size_from_readline).with(verbose: true)
expect(screen).not_to have_received(:size_from_tput)
end

it "falls through all detections to the default size" do
size_from_methods = {
size_from_java: nil,
Expand Down

0 comments on commit 4b5585a

Please sign in to comment.