Sha256: 41f255dea1a086ce2496faa4f7d9aa5af5517cd5548e7660eaa432447d8d6b4c

Contents?: true

Size: 1.22 KB

Versions: 1

Compression:

Stored size: 1.22 KB

Contents

require 'spec_helper'

module Omnibus
  # Used in the tests
  class FakePublisher; end

  describe Publisher do
    it { should be_a_kind_of(Logging) }

    describe '.publish' do
      let(:publisher) { double(described_class) }

      before { described_class.stub(:new).and_return(publisher) }

      it 'creates a new instance of the class' do
        expect(described_class).to receive(:new).once
        expect(publisher).to receive(:publish).once
        described_class.publish('/path/to/*.deb')
      end
    end

    let(:pattern) { '/path/to/files/*.deb' }
    let(:options) { { some_option: true } }

    subject { described_class.new(pattern, options) }

    describe '#packages' do
      let(:a) { '/path/to/files/a.deb' }
      let(:b) { '/path/to/files/b.deb' }
      let(:glob) { [a, b] }

      before { Dir.stub(:glob).with(pattern).and_return(glob) }

      it 'returns an array' do
        expect(subject.packages).to be_an(Array)
      end

      it 'returns an array of Package objects' do
        expect(subject.packages.first).to be_a(Package)
      end
    end

    describe '#publish' do
      it 'is an abstract method' do
        expect { subject.publish }.to raise_error(AbstractMethod)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
omnibus-3.2.0.rc.1 spec/unit/publisher_spec.rb