Sha256: 6e2501cfdd76c4e11b40bfcc132f900e7be1e48d748e7d2d4cb6951ead03f728

Contents?: true

Size: 913 Bytes

Versions: 9

Compression:

Stored size: 913 Bytes

Contents

#!/usr/bin/env rspec
require 'spec_helper'
require 'puppet/application/facts'

describe Puppet::Application::Facts do
  before :each do
    subject.command_line.stubs(:subcommand_name).returns 'facts'
  end

  it "should fail if no key is given to find" do
    subject.command_line.stubs(:args).returns %w{find}
    expect {
      expect { subject.run }.to exit_with 1
    }.to have_printed /err: puppet facts find takes 1 argument, but you gave 0/
    @logs.first.to_s.should =~ /puppet facts find takes 1 argument, but you gave 0/
  end

  it "should return facts if a key is given to find", :'fails_on_ruby_1.9.2' => true do
    Puppet::Node::Facts.indirection.reset_terminus_class
    subject.command_line.stubs(:args).returns %w{find whatever --render-as yaml}

    expect {
      expect { subject.run }.to exit_with 0
    }.to have_printed(/object:Puppet::Node::Facts/)

    @logs.should be_empty
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
puppet-2.7.26 spec/unit/application/facts_spec.rb
puppet-2.7.25 spec/unit/application/facts_spec.rb
puppet-2.7.24 spec/unit/application/facts_spec.rb
puppet-2.7.23 spec/unit/application/facts_spec.rb
puppet-2.7.22 spec/unit/application/facts_spec.rb
puppet-2.7.21 spec/unit/application/facts_spec.rb
puppet-2.7.20 spec/unit/application/facts_spec.rb
puppet-2.7.20.rc1 spec/unit/application/facts_spec.rb
puppet-2.7.19 spec/unit/application/facts_spec.rb