Sha256: f6b60308d8f2beae38f6ac9d6263fc0fc3c4afb75d82a731d3c71d942ee3df7b

Contents?: true

Size: 1001 Bytes

Versions: 12

Compression:

Stored size: 1001 Bytes

Contents

require 'spec_helper'
require production_code

describe RakeNBake::DependencyChecker do
  let(:silent) { true }
  let(:list) { %w[present missing] }

  subject { RakeNBake::DependencyChecker.new list }

  before do
    double_cmd('which present', exit: 0)
    double_cmd('which missing', exit: 1)
  end

  describe '#check' do
    it 'returns a hash of dependencies => presence' do
      result = subject.check(silent)
      expect(result).to eq('present' => true, 'missing' => false)
    end

    it 'prints a dot for dependencies which are present' do
      expect { subject.check }.to output(/\./).to_stdout
    end

    it 'prints a F for missing dependencies' do
      expect { subject.check }.to output(/F/).to_stdout
    end

    it 'can be run without printing anything out' do
      expect { subject.check(silent) }.to_not output.to_stdout
    end
  end

  describe '#missing' do
    it 'returns only missing dependencies' do
      expect(subject.missing).to eq ['missing']
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
rake-n-bake-3.1.2 spec/dependency_checker_spec.rb
rake-n-bake-3.1.1 spec/dependency_checker_spec.rb
rake-n-bake-3.1.0 spec/dependency_checker_spec.rb
rake-n-bake-3.0.0 spec/dependency_checker_spec.rb
rake-n-bake-2.1.4 spec/dependency_checker_spec.rb
rake-n-bake-2.1.3 spec/dependency_checker_spec.rb
rake-n-bake-2.1.2 spec/dependency_checker_spec.rb
rake-n-bake-2.1.1 spec/dependency_checker_spec.rb
rake-n-bake-2.1.0 spec/dependency_checker_spec.rb
rake-n-bake-2.0.1 spec/dependency_checker_spec.rb
rake-n-bake-2.0.0 spec/dependency_checker_spec.rb
rake-n-bake-1.4.3 spec/dependency_checker_spec.rb