File: exit_condition_spec.rb

package info (click to toggle)
ruby-thor 0.15.3-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 608 kB
  • sloc: ruby: 6,481; makefile: 2
file content (19 lines) | stat: -rw-r--r-- 482 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
require 'thor/base'

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

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

    lambda { task.start(["my_action"]) }.should raise_error(SystemExit)
    epiped.should == true
  end
end