Sha256: 84a2f6538e4bc5cc3a198c11fa39f52e6f836c7d247ccdccc0a0559296fea2f3

Contents?: true

Size: 1.41 KB

Versions: 19

Compression:

Stored size: 1.41 KB

Contents

#!/usr/bin/env ruby

require File.dirname(__FILE__) + '/../../spec_helper'
require 'puppet/util/rails/reference_serializer'

class SerializeTester
  include Puppet::Util::ReferenceSerializer
end

describe Puppet::Util::ReferenceSerializer do
  before do
    @tester = SerializeTester.new
  end

  describe "when serializing" do
    it "should yaml-dump resource references" do
      ref = Puppet::Resource.new("file", "/foo")
      @tester.serialize_value(ref).should =~ /^---/
    end

    it "should convert the boolean 'true' into the string 'true'" do
      @tester.serialize_value(true).should == "true"
    end

    it "should convert the boolean 'false' into the string 'false'" do
      @tester.serialize_value(false).should == "false"
    end

    it "should return all other values" do
      @tester.serialize_value("foo").should == "foo"
    end
  end

  describe "when unserializing" do
    it "should yaml-load values that look like yaml" do
      yaml = YAML.dump(%w{a b c})
      @tester.unserialize_value(yaml).should == %w{a b c}
    end

    it "should convert the string 'true' into the boolean 'true'" do
      @tester.unserialize_value("true").should == true
    end

    it "should convert the string 'false' into the boolean 'false'" do
      @tester.unserialize_value("false").should == false
    end

    it "should return all other values" do
      @tester.unserialize_value("foo").should == "foo"
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
puppet-2.6.18 spec/unit/util/reference_serializer_spec.rb
puppet-2.6.17 spec/unit/util/reference_serializer_spec.rb
puppet-2.6.16 spec/unit/util/reference_serializer_spec.rb
puppet-2.6.15 spec/unit/util/reference_serializer_spec.rb
puppet-2.6.14 spec/unit/util/reference_serializer_spec.rb
puppet-2.6.13 spec/unit/util/reference_serializer_spec.rb
puppet-2.6.12 spec/unit/util/reference_serializer_spec.rb
puppet-2.6.11 spec/unit/util/reference_serializer_spec.rb
puppet-2.6.10 spec/unit/util/reference_serializer_spec.rb
puppet-2.6.9 spec/unit/util/reference_serializer_spec.rb
puppet-2.6.8 spec/unit/util/reference_serializer_spec.rb
puppet-2.6.7 spec/unit/util/reference_serializer_spec.rb
puppet-2.6.6 spec/unit/util/reference_serializer_spec.rb
puppet-2.6.5 spec/unit/util/reference_serializer_spec.rb
puppet-2.6.4 spec/unit/util/reference_serializer_spec.rb
puppet-2.6.3 spec/unit/util/reference_serializer_spec.rb
puppet-2.6.2 spec/unit/util/reference_serializer_spec.rb
puppet-2.6.1 spec/unit/util/reference_serializer_spec.rb
puppet-2.6.0 spec/unit/util/reference_serializer_spec.rb