Sha256: 5b1fdb6f1e76312fb83f2edf1d1bc898465315c1a7f3b855e8c508352a695f0a

Contents?: true

Size: 1.91 KB

Versions: 52

Compression:

Stored size: 1.91 KB

Contents

require "spec_helper"
require "opsicle"

module Opsicle
  module Errors

    describe DeployFailed do
      let(:deploy) { {:name=>"deploy"} }

      it "set's it default message to 'deploy failed!'" do
        expect(subject.message).to eq('deploy failed!')
      end

      context "with a custom command passed in" do
        let(:deploy) { {:name => "update_custom_cookbooks"} }
        subject { DeployFailed.new(deploy) }

        it "updates the error message" do
          expect(subject.message).to eq('update_custom_cookbooks failed!')
        end
      end

      context "with an execute_recipes command passed in" do
        let(:deploy) { {:name => "execute_recipes", :args=>{"recipes"=>["app-configs", "deploy::default"]}} }
        subject { DeployFailed.new(deploy) }

        it "updates the error message" do
          expect(subject.message).to eq('execute_recipes (running [app-configs, deploy::default]) failed!')
        end
      end

      describe "#command_string" do
        context "if @command is nil" do
          it "returns 'deploy' if command is nil" do
            expect(subject.command_string).to eq('deploy')
          end
        end

        context "if @command is update_custom_cookbooks" do
          let(:deploy) { {:name => "update_custom_cookbooks"} }
          subject { DeployFailed.new deploy }

          it "returns 'update_custom_cookbooks'" do
            expect(subject.command_string).to eq('update_custom_cookbooks')
          end
        end

        context "if @command is execute_recipes" do
          let(:deploy) { {:name => "execute_recipes", :args=>{"recipes"=>["app-configs", "deploy::default"]}} }
          subject { DeployFailed.new deploy }

          it "returns 'execute_recipes (running [app-configs, deploy::default])'" do
            expect(subject.command_string).to eq('execute_recipes (running [app-configs, deploy::default])')
          end
        end
      end
    end

  end
end

Version data entries

52 entries across 52 versions & 1 rubygems

Version Path
opsicle-2.15.0 spec/opsicle/errors_spec.rb
opsicle-2.14.2 spec/opsicle/errors_spec.rb
opsicle-2.14.1 spec/opsicle/errors_spec.rb
opsicle-2.14.0 spec/opsicle/errors_spec.rb
opsicle-2.13.1 spec/opsicle/errors_spec.rb
opsicle-2.13.0 spec/opsicle/errors_spec.rb
opsicle-2.12.5 spec/opsicle/errors_spec.rb
opsicle-2.12.3 spec/opsicle/errors_spec.rb
opsicle-2.12.2 spec/opsicle/errors_spec.rb
opsicle-2.12.1 spec/opsicle/errors_spec.rb
opsicle-2.12.0 spec/opsicle/errors_spec.rb
opsicle-2.11.3 spec/opsicle/errors_spec.rb
opsicle-2.11.1 spec/opsicle/errors_spec.rb
opsicle-2.11.0 spec/opsicle/errors_spec.rb
opsicle-2.10.1 spec/opsicle/errors_spec.rb
opsicle-2.10.0 spec/opsicle/errors_spec.rb
opsicle-2.9.6 spec/opsicle/errors_spec.rb
opsicle-2.9.4 spec/opsicle/errors_spec.rb
opsicle-2.9.3 spec/opsicle/errors_spec.rb
opsicle-2.9.2 spec/opsicle/errors_spec.rb