Sha256: ba6cb85b3c3caddf9e6fc54052aa0262a096d94e8110cd6a991d4157055feee2

Contents?: true

Size: 1.46 KB

Versions: 1

Compression:

Stored size: 1.46 KB

Contents

require 'spec_helper'

describe Belajar::Terminal::CLI do

  it { is_expected.to be_a Thor }
  it { is_expected.to respond_to :about }
  it { is_expected.to respond_to :welcome }
  it { is_expected.to respond_to :scaffold }
  it { is_expected.to respond_to :learn }
  it { is_expected.to respond_to :courses }
  it { is_expected.to respond_to :solutions }
  it { is_expected.to respond_to :setup }

  describe "#learn" do
    it "starts the belajar terminal app if there are courses" do
      allow(Belajar::Loading::Courses).to receive(:load) { [1] }
      allow(Belajar).to receive(:start) { true }
      expect(Belajar).to receive(:start)

      subject.learn
    end

    it "does not start the belajar terminal app if there are no courses" do
      suppress_print_out
      allow(Belajar::Loading::Courses).to receive(:load) { [] }
      allow(Belajar).to receive(:start) { true }
      expect(Belajar).not_to receive(:start)

      subject.learn
    end
  end

  describe "#welcome" do
    it "runs the welcome routine" do
      allow(Belajar::Terminal::Welcome).to receive(:run) { true }
      expect(Belajar::Terminal::Welcome).to receive(:run).once

      subject.welcome
    end
  end

  describe "#scaffold" do
    it "runs the scaffolding" do
      allow($stdout).to receive(:puts) {}
      allow_any_instance_of(Belajar::Generator).to receive(:scaffold) { true }
      expect_any_instance_of(Belajar::Generator).to receive(:scaffold).once

      subject.scaffold
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
belajar-0.1.1 spec/belajar/terminal/cli_spec.rb