Sha256: cbbb3745fec6f2536b55ff2fc7390bf6964564c5ab183f0bc8877fb6da0fbd62

Contents?: true

Size: 1.27 KB

Versions: 4

Compression:

Stored size: 1.27 KB

Contents

#! /usr/bin/env ruby -S rspec
require 'spec_helper'
require 'puppet/face'

describe Puppet::Face[:instrumentation_listener, '0.0.1'] do
  it_should_behave_like "an indirector face"

  [:enable, :disable].each do |m|
    describe "when running ##{m}" do
      before(:each) do
        @listener = stub_everything 'listener'
        Puppet::Face[:instrumentation_listener, '0.0.1'].stubs(:find).returns(@listener)
        Puppet::Face[:instrumentation_listener, '0.0.1'].stubs(:save)
        Puppet::Util::Instrumentation::Listener.indirection.stubs(:terminus_class=)
      end

      it "should force the REST terminus" do
        Puppet::Util::Instrumentation::Listener.indirection.expects(:terminus_class=).with(:rest)
        subject.send(m, "dummy")
      end

      it "should find the named listener" do
        Puppet::Face[:instrumentation_listener, '0.0.1'].expects(:find).with("dummy").returns(@listener)
        subject.send(m, "dummy")
      end

      it "should #{m} the named listener" do
        @listener.expects(:enabled=).with( m == :enable )
        subject.send(m, "dummy")
      end

      it "should save finally the listener" do
        Puppet::Face[:instrumentation_listener, '0.0.1'].expects(:save).with(@listener)
        subject.send(m, "dummy")
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
puppet-3.0.0.rc8 spec/unit/face/instrumentation_listener_spec.rb
puppet-3.0.0.rc7 spec/unit/face/instrumentation_listener_spec.rb
puppet-3.0.0.rc5 spec/unit/face/instrumentation_listener_spec.rb
puppet-3.0.0.rc4 spec/unit/face/instrumentation_listener_spec.rb