Sha256: c3f3047ce79a28fbb69f0fbdd1acd623452b9350a2c3f653b5c8d584f765865a

Contents?: true

Size: 896 Bytes

Versions: 92

Compression:

Stored size: 896 Bytes

Contents

#! /usr/bin/env ruby
require 'spec_helper'

require 'puppet/util/errors'

class ErrorTester
  include Puppet::Util::Errors
  attr_accessor :line, :file
end

describe Puppet::Util::Errors do
  before do
    @tester = ErrorTester.new
  end

  it "should provide a 'fail' method" do
    @tester.should respond_to(:fail)
  end

  it "should provide a 'devfail' method" do
    @tester.should respond_to(:devfail)
  end

  it "should raise any provided error when failing" do
    lambda { @tester.fail(Puppet::ParseError, "stuff") }.should raise_error(Puppet::ParseError)
  end

  it "should default to Puppet::Error when failing" do
    lambda { @tester.fail("stuff") }.should raise_error(Puppet::Error)
  end

  it "should have a method for converting error context into a string" do
    @tester.file = "/my/file"
    @tester.line = 50
    @tester.error_context.should == " at /my/file:50"
  end
end

Version data entries

92 entries across 92 versions & 2 rubygems

Version Path
puppet-3.8.7 spec/unit/util/errors_spec.rb
puppet-3.8.7-x86-mingw32 spec/unit/util/errors_spec.rb
puppet-3.8.7-x64-mingw32 spec/unit/util/errors_spec.rb
puppet-3.8.6 spec/unit/util/errors_spec.rb
puppet-3.8.6-x86-mingw32 spec/unit/util/errors_spec.rb
puppet-3.8.6-x64-mingw32 spec/unit/util/errors_spec.rb
puppet-3.8.5 spec/unit/util/errors_spec.rb
puppet-3.8.5-x86-mingw32 spec/unit/util/errors_spec.rb
puppet-3.8.5-x64-mingw32 spec/unit/util/errors_spec.rb
puppet-3.8.4 spec/unit/util/errors_spec.rb
puppet-3.8.4-x86-mingw32 spec/unit/util/errors_spec.rb
puppet-3.8.4-x64-mingw32 spec/unit/util/errors_spec.rb
puppet-3.8.3 spec/unit/util/errors_spec.rb
puppet-3.8.3-x86-mingw32 spec/unit/util/errors_spec.rb
puppet-3.8.3-x64-mingw32 spec/unit/util/errors_spec.rb
puppet-3.8.2 spec/unit/util/errors_spec.rb
puppet-3.8.2-x86-mingw32 spec/unit/util/errors_spec.rb
puppet-3.8.2-x64-mingw32 spec/unit/util/errors_spec.rb
puppet-3.8.1 spec/unit/util/errors_spec.rb
puppet-3.8.1-x86-mingw32 spec/unit/util/errors_spec.rb