Sha256: 94d7e0bc0dafc2f5e45c09b25ac7613dc323d2b83d9e36412b69b21d2f79422d

Contents?: true

Size: 1.2 KB

Versions: 324

Compression:

Stored size: 1.2 KB

Contents

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

require 'matchers/json'

describe Puppet::Status do
  include JSONMatchers

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

  it "should default to is_alive is true" do
    expect(Puppet::Status.new.status["is_alive"]).to eq(true)
  end

  it "should return a json hash" do
    expect(Puppet::Status.new.status.to_json).to eq('{"is_alive":true}')
  end

  it "should render to a json hash" do
    expect(JSON::pretty_generate(Puppet::Status.new)).to match(/"is_alive":\s*true/)
  end

  it "should accept a hash from json" do
    status = Puppet::Status.new( { "is_alive" => false } )
    expect(status.status).to eq({ "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 "serializes to JSON that conforms to the status schema" do
    status = Puppet::Status.new
    status.version = Puppet.version

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

Version data entries

324 entries across 324 versions & 1 rubygems

Version Path
puppet-6.29.0 spec/unit/status_spec.rb
puppet-6.29.0-x86-mingw32 spec/unit/status_spec.rb
puppet-6.29.0-x64-mingw32 spec/unit/status_spec.rb
puppet-6.29.0-universal-darwin spec/unit/status_spec.rb
puppet-6.28.0 spec/unit/status_spec.rb
puppet-6.28.0-x86-mingw32 spec/unit/status_spec.rb
puppet-6.28.0-x64-mingw32 spec/unit/status_spec.rb
puppet-6.28.0-universal-darwin spec/unit/status_spec.rb
puppet-6.27.0 spec/unit/status_spec.rb
puppet-6.27.0-x86-mingw32 spec/unit/status_spec.rb
puppet-6.27.0-x64-mingw32 spec/unit/status_spec.rb
puppet-6.27.0-universal-darwin spec/unit/status_spec.rb
puppet-6.26.0 spec/unit/status_spec.rb
puppet-6.26.0-x86-mingw32 spec/unit/status_spec.rb
puppet-6.26.0-x64-mingw32 spec/unit/status_spec.rb
puppet-6.26.0-universal-darwin spec/unit/status_spec.rb
puppet-6.25.1 spec/unit/status_spec.rb
puppet-6.25.1-x86-mingw32 spec/unit/status_spec.rb
puppet-6.25.1-x64-mingw32 spec/unit/status_spec.rb
puppet-6.25.1-universal-darwin spec/unit/status_spec.rb