Sha256: bee2a4c68da70779ff343d31984737762e0cd6a5afcf2b878cc61770fb90147b

Contents?: true

Size: 1.06 KB

Versions: 2

Compression:

Stored size: 1.06 KB

Contents

# coding: utf-8
require "spec_helper"

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

  before do
    I18n.stub(:t) { |args| args }

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

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

    it { expect(run).to include "commands.checkup.success" }
  end

  context "when errors occurred" do
    let(:repository) { double("Repository", valid?: false, errors: ["Damn"]) }
    let(:configuration) { double("Configuration", valid?: 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.1.1 spec/lib/abak-flow/commands/checkup_spec.rb
abak-flow-1.1.0 spec/lib/abak-flow/commands/checkup_spec.rb