Sha256: d1e9e0c8b25f564606cd4eb3f3d5ca85b505fa811859d044b3b9a6d80b75d494

Contents?: true

Size: 1.26 KB

Versions: 5

Compression:

Stored size: 1.26 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 :should_run? do
    it "always runs without --try option" do
      @ctx.register(:run_options){ {:try => false} }
      @ctx.client.should_run?('branch_does_not_matter').must_equal true
    end

    it "runs with --try option only for 'run' action" do
      @ctx.register(:run_options){ {:try => true} }
      @ctx.client.should_run?('run').must_equal true
    end

    it "does not run with --try option, if not 'run' action" do
      @ctx.register(:run_options){ {:try => true} }
      @ctx.client.should_run?('some_random_action').must_equal false
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
runpuppet-1.0.0 test/client_test.rb
runpuppet-1.0.0.rc6 test/client_test.rb
runpuppet-1.0.0.rc5 test/client_test.rb
runpuppet-1.0.0.rc4 test/client_test.rb
runpuppet-1.0.0.rc2 test/client_test.rb