Sha256: fb07e8326edc6298723c8e60b9a048a4607713451ffb19a3ffb6ef7d083e4eb8

Contents?: true

Size: 896 Bytes

Versions: 35

Compression:

Stored size: 896 Bytes

Contents

#!/usr/bin/env rspec
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

35 entries across 35 versions & 3 rubygems

Version Path
puppet-2.7.26 spec/unit/util/errors_spec.rb
puppet-2.7.25 spec/unit/util/errors_spec.rb
puppet-2.7.24 spec/unit/util/errors_spec.rb
puppet-2.7.23 spec/unit/util/errors_spec.rb
puppet-2.7.22 spec/unit/util/errors_spec.rb
puppet-2.7.21 spec/unit/util/errors_spec.rb
puppet-2.7.20 spec/unit/util/errors_spec.rb
puppet-2.7.20.rc1 spec/unit/util/errors_spec.rb
librarian-puppet-0.9.4 vendor/gems/ruby/1.8/gems/puppet-2.7.18/spec/unit/util/errors_spec.rb
puppet-2.7.19 spec/unit/util/errors_spec.rb
supply_drop-0.11.0 examples/vendored-puppet/vendor/puppet-2.7.8/spec/unit/util/errors_spec.rb
librarian-puppet-0.9.3 vendor/gems/ruby/1.8/gems/puppet-2.7.18/spec/unit/util/errors_spec.rb
supply_drop-0.10.2 examples/vendored-puppet/vendor/puppet-2.7.8/spec/unit/util/errors_spec.rb
puppet-2.7.18 spec/unit/util/errors_spec.rb
supply_drop-0.10.1 examples/vendored-puppet/vendor/puppet-2.7.8/spec/unit/util/errors_spec.rb
supply_drop-0.10.0 examples/vendored-puppet/vendor/puppet-2.7.8/spec/unit/util/errors_spec.rb
puppet-2.7.17 spec/unit/util/errors_spec.rb
puppet-2.7.16 spec/unit/util/errors_spec.rb
puppet-2.7.14 spec/unit/util/errors_spec.rb
puppet-2.7.13 spec/unit/util/errors_spec.rb