Sha256: 3896b76699b7ab384c390c4762f7d91b480ff25dd81701e364089d863619e06b

Contents?: true

Size: 807 Bytes

Versions: 4

Compression:

Stored size: 807 Bytes

Contents

require 'spec_helper'

module Berkshelf
  describe Visualizer do
    describe '#to_png' do
      context 'when graphviz is not installed' do
        before do
          Berkshelf.stub(:which)
            .with('dot')
            .and_return(nil)
        end

        it 'raises a GraphvizNotInstalled exception' do
          expect { subject.to_png }.to raise_error(GraphvizNotInstalled)
        end
      end

      context 'when the graphviz command fails', :graphviz do
        before do
          response = double(success?: false, stderr: 'Something happened!')
          subject.stub(:shell_out).and_return(response)
        end

        it 'raises a GraphvizCommandFailed exception' do
          expect { subject.to_png }.to raise_error(GraphvizCommandFailed)
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
berkshelf-3.1.5 spec/unit/berkshelf/visualizer_spec.rb
berkshelf-3.1.4 spec/unit/berkshelf/visualizer_spec.rb
berkshelf-3.1.3 spec/unit/berkshelf/visualizer_spec.rb
berkshelf-3.1.2 spec/unit/berkshelf/visualizer_spec.rb