File: exit_error_spec.rb

package info (click to toggle)
ruby-tty-command 0.10.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 452 kB
  • sloc: ruby: 1,990; makefile: 4; sh: 4
file content (25 lines) | stat: -rw-r--r-- 759 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# frozen_string_literal: true

RSpec.describe TTY::Command::ExitError, "info" do
  it "displays stdin & stdout" do
    result = double(exit_status: 157, out: "out content", err: "err content")
    error = described_class.new(:cat, result)
    expect(error.message).to eq([
      "Running `cat` failed with\n",
      "  exit status: 157\n",
      "  stdout: out content\n",
      "  stderr: err content\n"
    ].join)
  end

  it "explains no stdin & stdout" do
    result = double(exit_status: 157, out: "", err: "")
    error = described_class.new(:cat, result)
    expect(error.message).to eq([
      "Running `cat` failed with\n",
      "  exit status: 157\n",
      "  stdout: Nothing written\n",
      "  stderr: Nothing written\n"
    ].join)
  end
end