Sha256: 4029ffcc96e5a6aa3bb4870cf221053fcfb22e394d9e6293dc276c07e2465782

Contents?: true

Size: 901 Bytes

Versions: 178

Compression:

Stored size: 901 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
    expect(@tester).to respond_to(:fail)
  end

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

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

  it "should default to Puppet::Error when failing" do
    expect { @tester.fail("stuff") }.to 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
    expect(@tester.error_context).to eq(" at /my/file:50")
  end
end

Version data entries

178 entries across 178 versions & 1 rubygems

Version Path
puppet-4.10.12 spec/unit/util/errors_spec.rb
puppet-4.10.12-x86-mingw32 spec/unit/util/errors_spec.rb
puppet-4.10.12-x64-mingw32 spec/unit/util/errors_spec.rb
puppet-4.10.12-universal-darwin spec/unit/util/errors_spec.rb
puppet-4.10.11 spec/unit/util/errors_spec.rb
puppet-4.10.11-x86-mingw32 spec/unit/util/errors_spec.rb
puppet-4.10.11-x64-mingw32 spec/unit/util/errors_spec.rb
puppet-4.10.11-universal-darwin spec/unit/util/errors_spec.rb
puppet-4.10.10 spec/unit/util/errors_spec.rb
puppet-4.10.10-x86-mingw32 spec/unit/util/errors_spec.rb
puppet-4.10.10-x64-mingw32 spec/unit/util/errors_spec.rb
puppet-4.10.10-universal-darwin spec/unit/util/errors_spec.rb
puppet-4.10.9 spec/unit/util/errors_spec.rb
puppet-4.10.9-x86-mingw32 spec/unit/util/errors_spec.rb
puppet-4.10.9-x64-mingw32 spec/unit/util/errors_spec.rb
puppet-4.10.9-universal-darwin spec/unit/util/errors_spec.rb
puppet-5.3.3 spec/unit/util/errors_spec.rb
puppet-5.3.3-x86-mingw32 spec/unit/util/errors_spec.rb
puppet-5.3.3-x64-mingw32 spec/unit/util/errors_spec.rb
puppet-5.3.3-universal-darwin spec/unit/util/errors_spec.rb