Sha256: aa7f27a4c4b9e6f88df367ea0c154bdfa7466e7ff3249b7e4dfe97ec60569b1f

Contents?: true

Size: 1.61 KB

Versions: 1

Compression:

Stored size: 1.61 KB

Contents

require 'spec/spec_helper'

module Pipeline
  describe InvalidPipelineError do
    it "should accept description message when raised" do
      lambda {raise InvalidPipelineError.new, "message"}.should raise_error(InvalidPipelineError, "message")
    end
  end

  describe InvalidStatusError do
    it "should accept status name as symbol" do
      lambda {raise InvalidStatusError.new(:started)}.should raise_error(InvalidStatusError, "Status is already started")
    end

    it "should accept status name as string" do
      lambda {raise InvalidStatusError.new("in progress")}.should raise_error(InvalidStatusError, "Status is already in progress")
    end

    it "should replace underscores with spaces" do
      lambda {raise InvalidStatusError.new(:in_progress)}.should raise_error(InvalidStatusError, "Status is already in progress")
    end
  end

  describe IrrecoverableError do
    it "should accept description message when raised" do
      lambda {raise IrrecoverableError.new, "message"}.should raise_error(IrrecoverableError, "message")
    end
  end

  describe RecoverableError do
    it "should accept description message when raised" do
      lambda {raise RecoverableError.new, "message"}.should raise_error(RecoverableError, "message")
      lambda {raise RecoverableError.new("message")}.should raise_error(RecoverableError, "message")
    end
    
    it "might require user input" do
      error = RecoverableError.new("message", true)
      error.should be_input_required
    end

    it "doesn't require user input by default" do
      error = RecoverableError.new
      error.should_not be_input_required
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pipeline-0.0.9 spec/pipeline/errors_spec.rb