Sha256: b4a2be1f8ac70f6d0dc407336ee6483464d4695f27d124c5db615d3021458a5b

Contents?: true

Size: 1.28 KB

Versions: 1

Compression:

Stored size: 1.28 KB

Contents

require 'spec_helper'

describe Vx::Builder::BuildConfiguration::Deploy do
  let(:params) { { "shell" => '/bin/true' } }
  let(:deploy) { described_class.new params }
  subject { deploy }

  context "attributes" do
    subject { deploy.attributes }

    context "when is hash" do
      let(:params) { { "shell" => '/bin/true' } }
      it { should eq [{"shell" => "/bin/true"}] }
    end

    context "when is array" do
      let(:params) { [{"shell" => '/bin/true'}] }
      it { should eq [{"shell" => "/bin/true"}] }
    end

    context "when is nil" do
      let(:params) { nil }
      it { should eq [] }
    end
  end

  context "find_modules" do
    let(:branch) { 'master' }
    subject { deploy.find_modules branch }

    context "when deploy branch is empty array" do
      let(:params) { {'shell' => 'true'} }
      it { should_not be_empty }
    end

    context "when deploy branch is array" do
      let(:params) { {'shell' => 'true', 'branch' => ['master', 'production']} }

      it "should be true if branch found" do
        expect(deploy.find_modules 'master').to_not be_empty
        expect(deploy.find_modules 'production').to_not be_empty
      end

      it "should be false if branch not found" do
        expect(deploy.find_modules 'staging').to eq []
      end
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vx-builder-0.3.0 spec/lib/builder/build_configuration/deploy_spec.rb