Sha256: 0cf90ce1fa49694f44307955c3cc478b28a782c196eb8e46741a184ff4081679

Contents?: true

Size: 1.07 KB

Versions: 7

Compression:

Stored size: 1.07 KB

Contents

require 'spec_helper'

describe Berkshelf::API::CacheBuilder::Worker do
  describe "ClassMethods" do
    describe "::[]" do
      it "returns the class of the registered worker" do
        expect(described_class["supermarket"]).to eql(Berkshelf::API::CacheBuilder::Worker::Supermarket)
      end
    end

    describe "::register" do
      it "adds the item to the Hash of types" do
        worker = double('new-worker')
        described_class.register("rspec-2", worker)
        expect(described_class.types["rspec-2"]).to eql(worker)
      end
    end

    describe "::types" do
      subject { described_class.types }

      it "returns a Hash" do
        expect(subject).to be_a(Hash)
      end
    end
  end
end

describe Berkshelf::API::CacheBuilder::Worker::Base do
  describe "ClassMethods" do
    describe "::worker_type" do
      let(:klass) { Class.new(described_class) }

      it "registers the worker type and class to Worker.types" do
        klass.worker_type("rspec")
        expect(Berkshelf::API::CacheBuilder::Worker.types).to include("rspec")
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
berkshelf-api-3.0.0 spec/unit/berkshelf/api/cache_builder/worker_spec.rb
berkshelf-api-2.2.0 spec/unit/berkshelf/api/cache_builder/worker_spec.rb
berkshelf-api-2.1.3 spec/unit/berkshelf/api/cache_builder/worker_spec.rb
berkshelf-api-2.1.2 spec/unit/berkshelf/api/cache_builder/worker_spec.rb
berkshelf-api-2.1.1 spec/unit/berkshelf/api/cache_builder/worker_spec.rb
berkshelf-api-2.1.0 spec/unit/berkshelf/api/cache_builder/worker_spec.rb
berkshelf-api-2.0.0 spec/unit/berkshelf/api/cache_builder/worker_spec.rb