Sha256: d4f987c30c035ff58e59d9d9268e32452f4a8a9749be6cac097bdba6a2ed231f

Contents?: true

Size: 1.25 KB

Versions: 47

Compression:

Stored size: 1.25 KB

Contents

#! /usr/bin/env ruby
require 'spec_helper'
require 'puppet/util/diff'
require 'puppet/util/execution'

describe Puppet::Util::Diff do
  describe ".diff" do
    it "should execute the diff command with arguments" do
      Puppet[:diff] = 'foo'
      Puppet[:diff_args] = 'bar'

      Puppet::Util::Execution.expects(:execute).with(['foo', 'bar', 'a', 'b'], {:failonfail => false, :combine => false}).returns('baz')
      subject.diff('a', 'b').should == 'baz'
    end

    it "should execute the diff command with multiple arguments" do
      Puppet[:diff] = 'foo'
      Puppet[:diff_args] = 'bar qux'

      Puppet::Util::Execution.expects(:execute).with(['foo', 'bar', 'qux', 'a', 'b'], anything).returns('baz')
      subject.diff('a', 'b').should == 'baz'
    end

    it "should omit diff arguments if none are specified" do
      Puppet[:diff] = 'foo'
      Puppet[:diff_args] = ''

      Puppet::Util::Execution.expects(:execute).with(['foo', 'a', 'b'], {:failonfail => false, :combine => false}).returns('baz')
      subject.diff('a', 'b').should == 'baz'
    end

    it "should return empty string if the diff command is empty" do
      Puppet[:diff] = ''

      Puppet::Util::Execution.expects(:execute).never
      subject.diff('a', 'b').should == ''
    end
  end
end

Version data entries

47 entries across 47 versions & 1 rubygems

Version Path
puppet-3.8.1-x64-mingw32 spec/unit/util/diff_spec.rb
puppet-3.7.5 spec/unit/util/diff_spec.rb
puppet-3.7.5-x86-mingw32 spec/unit/util/diff_spec.rb
puppet-3.7.5-x64-mingw32 spec/unit/util/diff_spec.rb
puppet-3.7.4 spec/unit/util/diff_spec.rb
puppet-3.7.4-x86-mingw32 spec/unit/util/diff_spec.rb
puppet-3.7.4-x64-mingw32 spec/unit/util/diff_spec.rb
puppet-3.7.3 spec/unit/util/diff_spec.rb
puppet-3.7.3-x86-mingw32 spec/unit/util/diff_spec.rb
puppet-3.7.3-x64-mingw32 spec/unit/util/diff_spec.rb
puppet-3.7.2 spec/unit/util/diff_spec.rb
puppet-3.7.2-x86-mingw32 spec/unit/util/diff_spec.rb
puppet-3.7.2-x64-mingw32 spec/unit/util/diff_spec.rb
puppet-3.7.1 spec/unit/util/diff_spec.rb
puppet-3.7.1-x86-mingw32 spec/unit/util/diff_spec.rb
puppet-3.7.1-x64-mingw32 spec/unit/util/diff_spec.rb
puppet-3.7.0 spec/unit/util/diff_spec.rb
puppet-3.7.0-x86-mingw32 spec/unit/util/diff_spec.rb
puppet-3.7.0-x64-mingw32 spec/unit/util/diff_spec.rb
puppet-3.6.2 spec/unit/util/diff_spec.rb