Sha256: 1888cbe99346bbe7f210156f8ad751423ea53f77d5a9fdd7ee258d71c1102c71

Contents?: true

Size: 1.18 KB

Versions: 31

Compression:

Stored size: 1.18 KB

Contents

require 'spec_helper'

describe Vx::Builder::BuildConfiguration::Env do
  let(:params) { { 'matrix' => ['a', 'b'], 'global' => ['c', 'd'] } }
  let(:env)    { described_class.new params }
  subject { env }

  its(:attributes) { should eq("matrix" => ['a', 'b'], "global" => ['c', 'd']) }

  context "attributes" do

    context "when env is string" do
      let(:params) { 'foo' }
      its(:matrix)     { should eq [] }
      its(:global)     { should eq ["foo"] }
    end

    context "when env is array" do
      let(:params) { [:foo, :bar] }
      its(:matrix)     { should eq ['foo', 'bar'] }
      its(:global)     { should eq [] }
    end

    context "when env is array of one element" do
      let(:params) { [:foo] }
      its(:matrix)     { should eq [] }
      its(:global)     { should eq ['foo'] }
    end

    context "when env is valid hash" do
      let(:params) { { "global" => "foo", "matrix" => 'bar' } }
      its(:matrix)     { should eq ['bar'] }
      its(:global)     { should eq ['foo'] }
    end

    context "when env is invalid hash" do
      let(:params) { { "key" => "foo" } }
      its(:matrix)     { should eq [] }
      its(:global)     { should eq [] }
    end

  end
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
vx-builder-0.3.10 spec/lib/builder/build_configuration/env_spec.rb
vx-builder-0.3.9 spec/lib/builder/build_configuration/env_spec.rb
vx-builder-0.3.8 spec/lib/builder/build_configuration/env_spec.rb
vx-builder-0.3.7 spec/lib/builder/build_configuration/env_spec.rb
vx-builder-0.3.6 spec/lib/builder/build_configuration/env_spec.rb
vx-builder-0.3.5 spec/lib/builder/build_configuration/env_spec.rb
vx-builder-0.3.4 spec/lib/builder/build_configuration/env_spec.rb
vx-builder-0.3.3 spec/lib/builder/build_configuration/env_spec.rb
vx-builder-0.3.2 spec/lib/builder/build_configuration/env_spec.rb
vx-builder-0.3.1 spec/lib/builder/build_configuration/env_spec.rb
vx-builder-0.3.0 spec/lib/builder/build_configuration/env_spec.rb