Sha256: 0f0e4bbf59344b59f7ec0237254dafc2a64334789f17b29c3d4cb2a9c695cfe9

Contents?: true

Size: 1.23 KB

Versions: 34

Compression:

Stored size: 1.23 KB

Contents

require 'spec_helper'

describe Berkshelf::Mixin::DSLEval do
  let(:klass) do
    klass = Class.new
    klass.send(:include, described_class)
    klass
  end

  describe "ClassMethods" do
    describe "::clean_room" do
      subject { klass.clean_room }

      it "returns an anonymous class inheriting from DSLEval::CleanRoom" do
        expect(subject.superclass).to eql(described_class::CleanRoom)
      end
    end

    describe "::expose_method" do
      subject { klass }

      it "adds a method to the exposed methods" do
        klass.expose_method(:something)
        expect(subject.exposed_methods).to have(1).item
      end
    end

    describe "::exposed_methods" do
      it "returns an array" do
        expect(klass.exposed_methods).to be_a(Array)
      end
    end
  end

  describe "#dsl_eval" do
    subject do
      klass.new.dsl_eval { }
    end

    it "returns an instance of the including class" do
      expect(subject).to be_a(klass)
    end
  end

  describe "#dsl_eval_file" do
    let(:filepath) { tmp_path.join('somefile') }
    before { FileUtils.touch(filepath) }

    subject { klass.new.dsl_eval_file(filepath) }

    it "returns an instance of the including class" do
      expect(subject).to be_a(klass)
    end
  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
berkshelf-3.1.5 spec/unit/berkshelf/mixin/dsl_eval_spec.rb
berkshelf-3.1.4 spec/unit/berkshelf/mixin/dsl_eval_spec.rb
berkshelf-2.0.18 spec/unit/berkshelf/mixin/dsl_eval_spec.rb
berkshelf-2.0.17 spec/unit/berkshelf/mixin/dsl_eval_spec.rb
berkshelf-3.1.3 spec/unit/berkshelf/mixin/dsl_eval_spec.rb
berkshelf-3.1.2 spec/unit/berkshelf/mixin/dsl_eval_spec.rb
berkshelf-2.0.16 spec/unit/berkshelf/mixin/dsl_eval_spec.rb
berkshelf-3.1.1 spec/unit/berkshelf/mixin/dsl_eval_spec.rb
berkshelf-3.1.0 spec/unit/berkshelf/mixin/dsl_eval_spec.rb
berkshelf-3.0.1 spec/unit/berkshelf/mixin/dsl_eval_spec.rb
berkshelf-3.0.0 spec/unit/berkshelf/mixin/dsl_eval_spec.rb
berkshelf-2.0.15 spec/unit/berkshelf/mixin/dsl_eval_spec.rb
berkshelf-3.0.0.rc1 spec/unit/berkshelf/mixin/dsl_eval_spec.rb
berkshelf-3.0.0.beta9 spec/unit/berkshelf/mixin/dsl_eval_spec.rb
berkshelf-3.0.0.beta8 spec/unit/berkshelf/mixin/dsl_eval_spec.rb
berkshelf-3.0.0.beta7 spec/unit/berkshelf/mixin/dsl_eval_spec.rb
berkshelf-3.0.0.beta6 spec/unit/berkshelf/mixin/dsl_eval_spec.rb
berkshelf-2.0.14 spec/unit/berkshelf/mixin/dsl_eval_spec.rb
berkshelf-3.0.0.beta5 spec/unit/berkshelf/mixin/dsl_eval_spec.rb
berkshelf-2.0.13 spec/unit/berkshelf/mixin/dsl_eval_spec.rb