Sha256: 3c9e5e13357b5a74341aa9d9d0215117b01c8198ec3691e5d48fb7dd3b102962

Contents?: true

Size: 1.38 KB

Versions: 57

Compression:

Stored size: 1.38 KB

Contents

#! /usr/bin/env ruby
require 'spec_helper'

require 'matchers/json'

describe Puppet::Status do
  include JSONMatchers

  it "should implement find" do
    Puppet::Status.indirection.find( :default ).should be_is_a(Puppet::Status)
    Puppet::Status.indirection.find( :default ).status["is_alive"].should == true
  end

  it "should default to is_alive is true" do
    Puppet::Status.new.status["is_alive"].should == true
  end

  it "should return a pson hash" do
    Puppet::Status.new.status.to_pson.should == '{"is_alive":true}'
  end

  it "should render to a pson hash" do
    PSON::pretty_generate(Puppet::Status.new).should =~ /"is_alive":\s*true/
  end

  it "should accept a hash from pson" do
    status = Puppet::Status.new( { "is_alive" => false } )
    status.status.should == { "is_alive" => false }
  end

  it "should have a name" do
    Puppet::Status.new.name
  end

  it "should allow a name to be set" do
    Puppet::Status.new.name = "status"
  end

  it "can do a round-trip serialization via YAML" do
    status = Puppet::Status.new
    new_status = Puppet::Status.convert_from('yaml', status.render('yaml'))
    new_status.should equal_attributes_of(status)
  end

  it "serializes to PSON that conforms to the status schema" do
    status = Puppet::Status.new
    status.version = Puppet.version

    expect(status.render('pson')).to validate_against('api/schemas/status.json')
  end
end

Version data entries

57 entries across 57 versions & 1 rubygems

Version Path
puppet-3.8.7 spec/unit/status_spec.rb
puppet-3.8.7-x86-mingw32 spec/unit/status_spec.rb
puppet-3.8.7-x64-mingw32 spec/unit/status_spec.rb
puppet-3.8.6 spec/unit/status_spec.rb
puppet-3.8.6-x86-mingw32 spec/unit/status_spec.rb
puppet-3.8.6-x64-mingw32 spec/unit/status_spec.rb
puppet-3.8.5 spec/unit/status_spec.rb
puppet-3.8.5-x86-mingw32 spec/unit/status_spec.rb
puppet-3.8.5-x64-mingw32 spec/unit/status_spec.rb
puppet-3.8.4 spec/unit/status_spec.rb
puppet-3.8.4-x86-mingw32 spec/unit/status_spec.rb
puppet-3.8.4-x64-mingw32 spec/unit/status_spec.rb
puppet-3.8.3 spec/unit/status_spec.rb
puppet-3.8.3-x86-mingw32 spec/unit/status_spec.rb
puppet-3.8.3-x64-mingw32 spec/unit/status_spec.rb
puppet-3.8.2 spec/unit/status_spec.rb
puppet-3.8.2-x86-mingw32 spec/unit/status_spec.rb
puppet-3.8.2-x64-mingw32 spec/unit/status_spec.rb
puppet-3.8.1 spec/unit/status_spec.rb
puppet-3.8.1-x86-mingw32 spec/unit/status_spec.rb