Sha256: ba8be377ab93ea08cef0ef91b90ff8b07bf01d548fdf4adedda90817c8f443af

Contents?: true

Size: 796 Bytes

Versions: 2

Compression:

Stored size: 796 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' 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

2 entries across 2 versions & 1 rubygems

Version Path
berkshelf-3.1.1 spec/unit/berkshelf/visualizer_spec.rb
berkshelf-3.1.0 spec/unit/berkshelf/visualizer_spec.rb