Sha256: 59cd6e143887c3aa84026068f7078805b90f24a8cef3c43ce59fc39d4839442a

Contents?: true

Size: 1.32 KB

Versions: 2

Compression:

Stored size: 1.32 KB

Contents

require 'test/helper'

describe "Client" do
  before do
    @ctx   = Dim::Container.new(TestContext)
  end

  describe :run_command do
    it  "without --verbose param" do
      cmd = "cd /etc/puppet/repo && git fetch && git checkout -f origin/feature && puppet apply /etc/puppet/repo/manifests/site.pp"
      @ctx.client.run_command('feature').must_equal cmd
    end

    it  "with --verbose param" do
      @ctx.register(:run_options){ {:verbose => true} }
      cmd = "cd /etc/puppet/repo && git fetch && git checkout -f origin/feature && /etc/puppet/repo/bin/prepare_environment.rb && puppet apply -v /etc/puppet/repo/manifests/site.pp"
      @ctx.client.run_command('feature').must_equal cmd
    end
  end

  describe :local_run_params do
    it "always runs without --try option" do
      @ctx.register(:run_options){ {:try => false} }
      @ctx.client.local_run_params.must_equal ["run", "master"]
    end

    it "is nil with --try option" do
      @ctx.register(:run_options){ {:try => true} }
      @ctx.client.local_run_params.must_be_nil
    end
  end

  describe :remote_run_params do
    it "always runs without --try option" do
      @ctx.register(:run_options){ {:try => true} }
      @ctx.client.stubs(:remote_run_params).returns(["run", "master"])
      @ctx.client.calculate_run_params.must_equal ['run', 'master']
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
runpuppet-1.0.2 test/client_test.rb
runpuppet-1.0.1 test/client_test.rb