Sha256: ad028d86a6cc3387a3fb683778221b45c9795b09b869a8d37f5990a5840bb295

Contents?: true

Size: 1.65 KB

Versions: 17

Compression:

Stored size: 1.65 KB

Contents

require "spec_helper"

module Beaker
  module Options

    describe Presets do
      let(:presets)    { Presets.new }

      it "returns an env_vars OptionsHash" do
        expect(presets.env_vars).to be_instance_of(Beaker::Options::OptionsHash)
      end

      it "removes all empty/nil entries in env_vars" do
        expect(presets.env_vars.has_value?(nil)).to be === false
        expect(presets.env_vars.has_value?({})).to be === false
      end

      it "returns a presets OptionsHash" do
        expect(presets.presets).to be_instance_of(Beaker::Options::OptionsHash)
      end

      describe 'when setting the type as pe from the environment' do
        describe 'sets type to pe if...' do
          it 'env var is set to "true"' do
            munged = presets.format_found_env_vars( {:is_pe => 'true'} )
            expect( munged[:type] ).to be == 'pe'
          end
          it 'env var is set to "yes"' do
            munged = presets.format_found_env_vars( {:is_pe => 'yes'} )
            expect( munged[:type] ).to be == 'pe'
          end
        end
        describe 'sets type to foss if...' do
          it 'env var is set to "false"' do
            munged = presets.format_found_env_vars( {:is_pe => 'true'} )
            expect( munged[:type] ).to be == 'pe'
          end
          it 'env var is set to "no"' do
            munged = presets.format_found_env_vars( {:is_pe => 'yes'} )
            expect( munged[:type] ).to be == 'pe'
          end
        end
        it 'does not set type otherwise' do
          munged = presets.format_found_env_vars( {:is_pe => nil} )
          expect( munged[:type] ).to be == nil
        end
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
beaker-2.13.0 spec/beaker/options/presets_spec.rb
beaker-2.12.0 spec/beaker/options/presets_spec.rb
beaker-2.11.0 spec/beaker/options/presets_spec.rb
beaker-2.10.0 spec/beaker/options/presets_spec.rb
beaker-2.9.0 spec/beaker/options/presets_spec.rb
beaker-2.8.0 spec/beaker/options/presets_spec.rb
beaker-2.7.1 spec/beaker/options/presets_spec.rb
beaker-2.7.0 spec/beaker/options/presets_spec.rb
beaker-2.6.0 spec/beaker/options/presets_spec.rb
beaker-2.5.1 spec/beaker/options/presets_spec.rb
beaker-2.5.0 spec/beaker/options/presets_spec.rb
beaker-2.4.1 spec/beaker/options/presets_spec.rb
beaker-2.4.0 spec/beaker/options/presets_spec.rb
beaker-2.3.0 spec/beaker/options/presets_spec.rb
beaker-2.2.0 spec/beaker/options/presets_spec.rb
beaker-2.1.0 spec/beaker/options/presets_spec.rb
beaker-2.0.0 spec/beaker/options/presets_spec.rb