Sha256: 3143979b3db79eba435f8009e92686108ec595f8131c15c2514a70848c469f49
Contents?: true
Size: 1.39 KB
Versions: 1
Compression:
Stored size: 1.39 KB
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} } let(:model_reader) { double(Moblues::Reader::Model) } let(:model_generator) { double(Moblues::Generator::Model) } let(:entities) { [build(:entity)] } before do allow(Moblues::Reader::Model).to receive(:new) { model_reader } allow(Moblues::Generator::Model).to receive(:new) { model_generator } end it 'created the directories reads the model and generates the files' do expect(Dir).to receive(:mkdir).with('human/path').once expect(Dir).to receive(:mkdir).with('machine/path').once expect(model_reader).to receive(:model).with('model/path').once { entities } expect(model_generator).to receive(:generate).with(entities).once perform end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
moblues-0.0.1 | spec/moblues/cli_spec.rb |