Sha256: 3eedde994c9c380631d4def22f3563f457c9ab1f0be4fec0770f70605e024aef

Contents?: true

Size: 1.16 KB

Versions: 2

Compression:

Stored size: 1.16 KB

Contents

# coding: utf-8
require "spec_helper"

describe Abak::Flow::Commands::Checkup do
  let(:command) { described_class.new }
  let(:options) { double("Options") }
  let(:run) { command.run(Array.new, options) }
  let(:ansi) { double("ANSI") }
  let(:manager) do
    double("Manager", configuration: configuration,
      repository: repository)
  end

  before do
    stub_const('ANSI', ansi)
    ansi.stub(green: "Success")
    ansi.stub(red: "Fail")
    ansi.stub(yellow: "Warning")

    Abak::Flow::Manager.stub(instance: manager)
    Abak::Flow::Visitor.any_instance.stub(:say) { |args| args }
    Abak::Flow::Commands::Checkup.any_instance.stub(:say) { |args| args }
  end

  context "when no errors occurred" do
    let(:repository) { double("Repository", ready?: true, errors: Array.new) }
    let(:configuration) { double("Configuration", ready?: true, errors: Array.new) }

    it { expect(run).to eq "Success" }
  end

  context "when errors occurred" do
    let(:repository) { double("Repository", ready?: false, errors: ["Damn"]) }
    let(:configuration) { double("Configuration", ready?: true, errors: Array.new) }

    it { expect { run }.to raise_error SystemExit }
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
abak-flow-1.0.8 spec/lib/abak-flow/commands/checkup_spec.rb
abak-flow-1.0.7 spec/lib/abak-flow/commands/checkup_spec.rb