Sha256: 88203de807e8c799468c93e763db1b7ecefe337cce29a6ef8b88fa92eeb34c27

Contents?: true

Size: 686 Bytes

Versions: 4

Compression:

Stored size: 686 Bytes

Contents

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

require 'puppet/util/json_lockfile'

describe Puppet::Util::JsonLockfile do
  require 'puppet_spec/files'
  include PuppetSpec::Files

  before(:each) do
    @lockfile = tmpfile("lock")
    @lock = Puppet::Util::JsonLockfile.new(@lockfile)
  end

  describe "#lock" do
    it "should create a lock file containing a json hash" do
      data = { "foo" => "foofoo", "bar" => "barbar" }
      @lock.lock(data)

      PSON.parse(File.read(@lockfile)).should == data
    end
  end

  it "should return the lock data" do
    data = { "foo" => "foofoo", "bar" => "barbar" }
    @lock.lock(data)
    @lock.lock_data.should == data
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
puppet-3.0.0.rc8 spec/unit/util/json_lockfile_spec.rb
puppet-3.0.0.rc7 spec/unit/util/json_lockfile_spec.rb
puppet-3.0.0.rc5 spec/unit/util/json_lockfile_spec.rb
puppet-3.0.0.rc4 spec/unit/util/json_lockfile_spec.rb