Sha256: c0e8ff7e192d4c4a47efb89107d1d42a67e6f4a4f053d6865e9b17064d7a70a6
Contents?: true
Size: 1.66 KB
Versions: 2
Compression:
Stored size: 1.66 KB
Contents
require 'rspec' require 'spec_helper' module Berkshelf describe Visualizer, :not_supported_on_windows do describe '#to_png' do context 'when graphviz is not installed' do before do allow(Berkshelf).to receive(:which) .with('dot') .and_return(nil) allow(Berkshelf).to receive(:which) .with('dot.exe') .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!') allow(subject).to receive(:shell_out).and_return(response) end it 'raises a GraphvizCommandFailed exception' do expect { subject.to_png }.to raise_error(GraphvizCommandFailed) end end context 'when the graphviz command succeeds', :graphviz do it 'builds a dot from a Lockfile' do outfile = tmp_path.join('test-graph.dot').to_s lockfile = Lockfile.from_file(fixtures_path.join('lockfiles/default.lock').to_s) Visualizer.from_lockfile(lockfile).to_dot_file(outfile) expect(File.exists?(outfile)).to be true end it 'builds a png from a Lockfile' do outfile = tmp_path.join('test-graph.png').to_s lockfile = Lockfile.from_file(fixtures_path.join('lockfiles/default.lock').to_s) Visualizer.from_lockfile(lockfile).to_png(outfile) expect(File.exists?(outfile)).to be true end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
berkshelf-5.5.0 | spec/unit/berkshelf/visualizer_spec.rb |
berkshelf-5.4.0 | spec/unit/berkshelf/visualizer_spec.rb |