Sha256: 126cf05e847ed89d1faf6bee71bb06603f542c6bbe3aa31cb1f8fc3057626fe0

Contents?: true

Size: 1.41 KB

Versions: 53

Compression:

Stored size: 1.41 KB

Contents

describe Knapsack do
  describe '.tracker' do
    subject { described_class.tracker }

    it { should be_a Knapsack::Tracker }
    it { expect(subject.object_id).to eql described_class.tracker.object_id }
  end

  describe '.report' do
    subject { described_class.report }

    it { should be_a Knapsack::Report }
    it { expect(subject.object_id).to eql described_class.report.object_id }
  end

  describe '.root' do
    subject { described_class.root }

    it { expect(subject).to match 'knapsack' }
  end

  describe '.load_tasks' do
    let(:task_loader) { instance_double(Knapsack::TaskLoader) }

    it do
      expect(Knapsack::TaskLoader).to receive(:new).and_return(task_loader)
      expect(task_loader).to receive(:load_tasks)
      described_class.load_tasks
    end
  end

  describe '.logger' do
    subject { described_class.logger }

    before { described_class.logger = nil }
    after  { described_class.logger = nil }

    context 'when default logger' do
      let(:logger) { instance_double(Knapsack::Logger) }

      before do
        expect(Knapsack::Logger).to receive(:new).and_return(logger)
        expect(logger).to receive(:level=).with(Knapsack::Logger::INFO)
      end

      it { should eql logger }
    end

    context 'when custom logger' do
      let(:logger) { double('custom logger') }

      before do
        described_class.logger = logger
      end

      it { should eql logger }
    end
  end
end

Version data entries

53 entries across 53 versions & 1 rubygems

Version Path
knapsack-4.0.0 spec/knapsack_spec.rb
knapsack-3.1.0 spec/knapsack_spec.rb
knapsack-3.0.0 spec/knapsack_spec.rb
knapsack-2.0.0 spec/knapsack_spec.rb
knapsack-1.22.0 spec/knapsack_spec.rb
knapsack-1.21.1 spec/knapsack_spec.rb
knapsack-1.21.0 spec/knapsack_spec.rb
knapsack-1.20.0 spec/knapsack_spec.rb
knapsack-1.19.0 spec/knapsack_spec.rb
knapsack-1.18.0 spec/knapsack_spec.rb
knapsack-1.17.2 spec/knapsack_spec.rb
knapsack-1.17.1 spec/knapsack_spec.rb
knapsack-1.17.0 spec/knapsack_spec.rb
knapsack-1.16.0 spec/knapsack_spec.rb
knapsack-1.15.0 spec/knapsack_spec.rb
knapsack-1.14.1 spec/knapsack_spec.rb
knapsack-1.14.0 spec/knapsack_spec.rb
knapsack-1.13.3 spec/knapsack_spec.rb
knapsack-1.13.2 spec/knapsack_spec.rb
knapsack-1.13.1 spec/knapsack_spec.rb