Sha256: 4c3e28a11f88d5eedd5a1702d5da6ee1420901303d39b5920303436a5df578f1

Contents?: true

Size: 1.75 KB

Versions: 69

Compression:

Stored size: 1.75 KB

Contents

require 'spec_helper'
require 'r10k/feature'

describe R10K::Feature do
  describe "confining a feature to a library" do
    it "is available if the library can be loaded" do
      feature = described_class.new(:r10k, :libraries => 'r10k')
      expect(feature.available?).to be_truthy
    end

    it "is unavailable if the library cannot be loaded" do
      feature = described_class.new(:squidlibs, :libraries => 'squid/libs')
      expect(feature.available?).to be_falsey
    end
  end

  describe "confining a feature to a block" do
    it "is available if the block is true" do
      feature = described_class.new(:blockfeature) { true }
      expect(feature.available?).to be_truthy
    end

    it "is unavailable if the block is false" do
      feature = described_class.new(:blockfeature) { false }
      expect(feature.available?).to be_falsey
    end
  end

  describe  "confining a feature to both a block and libraries" do
    it "is unavailable if the block returns false and libraries are absent" do
      feature = described_class.new(:nope, :libraries => 'nope/nope') { false }
      expect(feature.available?).to be_falsey
    end

    it "is unavailable if the block returns true and libraries are absent" do
      feature = described_class.new(:nope, :libraries => 'nope/nope') { true }
      expect(feature.available?).to be_falsey
    end

    it "is unavailable if the block returns false and libraries are present" do
      feature = described_class.new(:nope, :libraries => 'r10k') { false }
      expect(feature.available?).to be_falsey
    end

    it "is available if the block returns true and libraries are present" do
      feature = described_class.new(:yep, :libraries => 'r10k') { true }
      expect(feature.available?).to be_truthy
    end
  end
end

Version data entries

69 entries across 69 versions & 2 rubygems

Version Path
r10k-3.0.0 spec/unit/feature_spec.rb
r10k-2.6.4 spec/unit/feature_spec.rb
r10k-2.6.3 spec/unit/feature_spec.rb
r10k-2.6.2 spec/unit/feature_spec.rb
r10k-2.6.1 spec/unit/feature_spec.rb
r10k-2.6.0 spec/unit/feature_spec.rb
r10k-2.5.5 spec/unit/feature_spec.rb
r10k-2.5.4 spec/unit/feature_spec.rb
r10k-2.5.3 spec/unit/feature_spec.rb
r10k-2.5.2 spec/unit/feature_spec.rb
r10k-2.5.1 spec/unit/feature_spec.rb
r10k-2.4.5 spec/unit/feature_spec.rb
r10k-2.3.1 spec/unit/feature_spec.rb
r10k-2.4.4 spec/unit/feature_spec.rb
r10k-2.5.0 spec/unit/feature_spec.rb
r10k-2.4.3 spec/unit/feature_spec.rb
r10k-2.4.1 spec/unit/feature_spec.rb
r10k-2.4.0 spec/unit/feature_spec.rb
r10k-2.3.0 spec/unit/feature_spec.rb
r10k-2.2.2 spec/unit/feature_spec.rb