Sha256: 24486c9ca39aece7f332e853c2417c58c5909a9a461847d801bfce95907ece4f

Contents?: true

Size: 1.55 KB

Versions: 35

Compression:

Stored size: 1.55 KB

Contents

#!/usr/bin/env rspec
require 'spec_helper'
require 'puppet/application/indirection_base'
require 'puppet/indirector/face'

########################################################################
# Stub for testing; the names are critical, sadly. --daniel 2011-03-30
class Puppet::Application::TestIndirection < Puppet::Application::IndirectionBase
end

face = Puppet::Indirector::Face.define(:testindirection, '0.0.1') do
  summary "fake summary"
  copyright "Puppet Labs", 2011
  license   "Apache 2 license; see COPYING"
end
# REVISIT: This horror is required because we don't allow anything to be
# :current except for if it lives on, and is loaded from, disk. --daniel 2011-03-29
face.instance_variable_set('@version', :current)
Puppet::Face.register(face)
########################################################################

describe Puppet::Application::IndirectionBase do
  subject { Puppet::Application::TestIndirection.new }

  it "should accept a terminus command line option" do
    # It would be nice not to have to stub this, but whatever... writing an
    # entire indirection stack would cause us more grief. --daniel 2011-03-31
    terminus = stub_everything("test indirection terminus")
    terminus.stubs(:name).returns(:testindirection)

    Puppet::Indirector::Indirection.expects(:instance).
      with(:testindirection).returns(terminus)

    subject.command_line.instance_variable_set('@args', %w{--terminus foo save bar})

    # Not a very nice thing. :(
    $stderr.stubs(:puts)
    Puppet.stubs(:err)

    expect { subject.run }.to exit_with 0
  end
end

Version data entries

35 entries across 35 versions & 3 rubygems

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