Sha256: eabe98bc9ca2da2f16cea06a6f0cbdaf8332b8c019edfdf0622446f9ce3ceab5

Contents?: true

Size: 1.82 KB

Versions: 26

Compression:

Stored size: 1.82 KB

Contents

require "spec_helper"

module Omnibus
  describe Software do
    it "is a sugarable" do
      expect(described_class.ancestors).to include(Sugarable)
    end
  end

  describe Metadata do
    it "extends Sugarable" do
      expect(described_class.singleton_class.included_modules).to include(Sugarable)
    end

    it "is a sugarable" do
      expect(described_class.ancestors).to include(Sugarable)
    end
  end

  describe Packager::Base do
    it "is a sugarable" do
      expect(described_class.ancestors).to include(Sugarable)
    end
  end

  describe Project do
    it "is a sugarable" do
      expect(described_class.ancestors).to include(Sugarable)
    end
  end

  describe Sugarable do
    context "in a cleanroom" do
      let(:klass) do
        Class.new do
          include Cleanroom
          include Sugarable
        end
      end

      let(:instance) { klass.new }

      it "includes the DSL methods" do
        expect(klass).to be_method_defined(:windows?)
        expect(klass).to be_method_defined(:vagrant?)
        expect(klass).to be_method_defined(:_64_bit?)
      end

      it "makes the DSL methods available in the cleanroom" do
        expect do
          instance.evaluate <<-EOH.gsub(/^ {12}/, "")
            windows?
            vagrant?
          EOH
        end.to_not raise_error
      end
    end
  end

  describe Sugar do
    let(:klass) do
      Class.new do
        include Sugar
      end
    end

    let(:instance) { klass.new }

    it "returns the windows architecture being built" do
      expect(Omnibus::Config).to receive(:windows_arch).and_return(:x86_64)
      expect(instance.windows_arch_i386?).to eq(false)
    end

    it "returns whether fips_mode is enabled" do
      expect(Omnibus::Config).to receive(:fips_mode).and_return(false)
      expect(instance.fips_mode?).to eq(false)
    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
omnibus-9.0.24 spec/unit/sugarable_spec.rb
omnibus-9.0.23 spec/unit/sugarable_spec.rb
omnibus-9.0.22 spec/unit/sugarable_spec.rb
omnibus-9.0.17 spec/unit/sugarable_spec.rb
omnibus-9.0.12 spec/unit/sugarable_spec.rb
omnibus-9.0.11 spec/unit/sugarable_spec.rb
omnibus-9.0.8 spec/unit/sugarable_spec.rb
omnibus-8.3.2 spec/unit/sugarable_spec.rb
omnibus-8.2.2 spec/unit/sugarable_spec.rb
omnibus-8.1.15 spec/unit/sugarable_spec.rb
omnibus-8.0.15 spec/unit/sugarable_spec.rb
omnibus-8.0.9 spec/unit/sugarable_spec.rb
omnibus-7.0.34 spec/unit/sugarable_spec.rb
omnibus-7.0.13 spec/unit/sugarable_spec.rb
omnibus-7.0.12 spec/unit/sugarable_spec.rb
omnibus-6.1.9 spec/unit/sugarable_spec.rb
omnibus-6.1.7 spec/unit/sugarable_spec.rb
omnibus-6.1.4 spec/unit/sugarable_spec.rb
omnibus-6.0.30 spec/unit/sugarable_spec.rb
omnibus-6.0.25 spec/unit/sugarable_spec.rb