Sha256: 52e29d92d9548b2f65c6bb2f2de92799f313a19940873fd5cc6b8da90a701f6d
Contents?: true
Size: 1.5 KB
Versions: 1
Compression:
Stored size: 1.5 KB
Contents
require 'spec_helper' describe "CLI" do include Helpers let(:command) do File.expand_path(File.join(File.dirname(__FILE__),'..','bin','bundler-leak')) end context "when auditing a bundle with unpatched gems" do let(:bundle) { 'unpatched_gems' } let(:directory) { File.join('spec','bundle', bundle) } subject do Dir.chdir(directory) { sh(command, :fail => true) } end it "should print a warning" do expect(subject).to include("Leaks found!") end it "should print advisory information for the leaky gems" do advisory_pattern = /(Name: [^\n]+ Version: \d+.\d+.\d+ URL: https?:\/\/(www\.)?.+ Title: [^\n]*? Solution: upgrade to (~>|>=) \d+\.\d+\.\d+(\.\d+)?(, (~>|>=) \d+\.\d+\.\d+(\.\d+)?)*[\s\n]*?)/ expect(subject).to match(advisory_pattern) expect(subject).to include("Leaks found!") end end describe "update" do let(:update_command) { "#{command} update" } let(:bundle) { 'unpatched_gems' } let(:directory) { File.join('spec','bundle',bundle) } subject do Dir.chdir(directory) { sh(update_command) } end context "when advisories update successfully" do it "should print status" do expect(subject).not_to include("Fail") expect(subject).to include("Updating ruby-mem-advisory-db ...\n") expect(subject).to include("Updated ruby-mem-advisory-db\n") expect(subject.lines.to_a.last).to match(/ruby-mem-advisory-db: \d+ advisories/) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
bundler-leak-0.1.1 | spec/integration_spec.rb |