Sha256: cc5322a3d99ed3a2fca91af382d748cc278b90c72066cde2b66b9b517cd9b56f

Contents?: true

Size: 893 Bytes

Versions: 1

Compression:

Stored size: 893 Bytes

Contents

require 'spec_helper'
require 'moblues/cli'

describe Moblues::CLI do
  subject { described_class }
  let(:perform) { subject.start([command] + options, debug: true) }

  context 'when command is invalid' do
    let(:command) { 'invalid' }
    let(:options) { [] }

    it 'fails' do
      expect { perform }.to raise_error
    end
  end

  context 'generate' do
    let(:command) { 'generate' }

    context 'when options missing' do
      let(:options) { [] }

      it 'fails' do
        expect { perform }.to raise_error
      end
    end

    context 'when options given' do
      let(:options) { %w{--model=model/path --human=human/path --machine=machine/path} }

      it 'created the directories reads the model and generates the files' do
        expect(Moblues).to receive(:generate).with('model/path', 'human/path', 'machine/path').once

        perform
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
moblues-0.1.0 spec/lib/moblues/cli_spec.rb