Sha256: a08d81873b3dc2037d85cfb19ebc1acd9d1209aa674526a0db87cca93cf405ad

Contents?: true

Size: 986 Bytes

Versions: 4

Compression:

Stored size: 986 Bytes

Contents

require 'bundler/audit/task'

describe Bundler::Audit::Task do
  let(:task) { Bundler::Audit::Task.new }

  context "default options" do
    it "runs bundle-audit check" do
      task = Bundler::Audit::Task.new(:audit_task)
      expect(Bundler::Audit::CLI).to receive(:start)
      task.send(:run)
    end

    it "creates task name" do
      task = Bundler::Audit::Task.new(:audit_task)
      expect(task.name).to eq(:audit_task)
      expect(task).to receive(:run) { true }
      Rake.application.invoke_task("audit_task")
    end

    it "can fail" do
      task = Bundler::Audit::Task.new(:failed_audit)
      Rake.application.invoke_task("failed_audit")
    end
  end

  context "verbose" do
    it "correctly adds verbose to the command" do
      task = Bundler::Audit::Task.new(:audit_test_1) do |r|
        r.verbose = true
      end
      expect(Bundler::Audit::CLI).to receive(:start).with ['check', '-v']
      Rake.application.invoke_task("audit_test_1")
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
mrjoy-bundler-audit-0.3.6 spec/rake_task_spec.rb
mrjoy-bundler-audit-0.3.5 spec/rake_task_spec.rb
mrjoy-bundler-audit-0.3.4 spec/rake_task_spec.rb
mrjoy-bundler-audit-0.3.3 spec/rake_task_spec.rb