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.15.0 spec/unit/feature_spec.rb
akerl-r10k-3.14.2.1 spec/unit/feature_spec.rb
r10k-3.14.2 spec/unit/feature_spec.rb
r10k-3.14.1 spec/unit/feature_spec.rb
r10k-3.14.0 spec/unit/feature_spec.rb
r10k-3.13.0 spec/unit/feature_spec.rb
r10k-3.12.1 spec/unit/feature_spec.rb
r10k-3.12.0 spec/unit/feature_spec.rb
r10k-3.11.0 spec/unit/feature_spec.rb
r10k-3.10.0 spec/unit/feature_spec.rb
r10k-3.9.3 spec/unit/feature_spec.rb
r10k-3.9.2 spec/unit/feature_spec.rb
r10k-3.9.1 spec/unit/feature_spec.rb
r10k-3.9.0 spec/unit/feature_spec.rb
r10k-3.8.0 spec/unit/feature_spec.rb
r10k-3.7.0 spec/unit/feature_spec.rb
r10k-3.6.0 spec/unit/feature_spec.rb
r10k-2.6.9 spec/unit/feature_spec.rb
r10k-3.5.2 spec/unit/feature_spec.rb
r10k-3.5.1 spec/unit/feature_spec.rb