Sha256: 8d5758b5ceefd15dc480cef758f16d9c1b9aa70c217f941daa1d5be3f526b4bd

Contents?: true

Size: 1.39 KB

Versions: 3

Compression:

Stored size: 1.39 KB

Contents

require 'spec_helper'

RSpec.describe PolishGeeks::DevTools::Commands::BundlerAudit do
  subject { described_class.new }

  describe '#execute' do
    let(:instance) { instance_double(PolishGeeks::DevTools::Shell) }

    before do
      allow(PolishGeeks::DevTools::Shell).to receive(:new) { instance }
      expect(instance).to receive(:execute)
        .with('bundle-audit update 2>&1 > /dev/null; bundle-audit check')
    end

    it { subject.execute }
  end

  describe '#valid?' do
    context 'when there are vulnerabilities' do
      before do
        output = <<-EOS
          Name: activesupport
          Version: 3.2.10
          Advisory: OSVDB-91451
          Criticality: High
          URL: http://www.osvdb.org/show/osvdb/91451
          Title: XML Parsing Vulnerability affecting JRuby users
          Solution: upgrade to ~> 3.1.12, >= 3.2.13

          Unpatched versions found!
        EOS
        subject.instance_variable_set('@output', output)
      end

      it { expect(subject.valid?).to eq false }
    end

    context 'when there are no vulnerabilities' do
      before { subject.instance_variable_set('@output', 'No vulnerabilities found') }

      it { expect(subject.valid?).to eq true }
    end
  end

  describe '.generator?' do
    it { expect(described_class.generator?).to eq false }
  end

  describe '.validator?' do
    it { expect(described_class.validator?).to eq true }
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
polishgeeks-dev-tools-1.3.2 spec/lib/polish_geeks/dev_tools/commands/bundler_audit_spec.rb
polishgeeks-dev-tools-1.3.1 spec/lib/polish_geeks/dev_tools/commands/bundler_audit_spec.rb
polishgeeks-dev-tools-1.3.0 spec/lib/polish_geeks/dev_tools/commands/bundler_audit_spec.rb