File: exit_condition_spec.rb

package info (click to toggle)
ruby-thor 0.19.1-3
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 792 kB
  • ctags: 567
  • sloc: ruby: 7,315; makefile: 2; sh: 1
file content (19 lines) | stat: -rw-r--r-- 433 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
require "helper"
require "thor/base"

describe "Exit conditions" do
  it "exits 0, not bubble up EPIPE, if EPIPE is raised" do
    epiped = false

    command = Class.new(Thor) do
      desc "my_action", "testing EPIPE"
      define_method :my_action do
        epiped = true
        fail Errno::EPIPE
      end
    end

    expect { command.start(["my_action"]) }.to raise_error(SystemExit)
    expect(epiped).to eq(true)
  end
end