Sha256: 0a68a0847c2187c53c7a04e85ef078b6e00e22558af57eabcc219ef71295638d

Contents?: true

Size: 1.13 KB

Versions: 2

Compression:

Stored size: 1.13 KB

Contents

require 'commands/create'

shared_examples_for 'a library' do
  let(:project) { 'test_project' }

  subject do
    described_class.class_options(
      quiet: true,
      pretend: true
    )
    described_class.new(['--library'])
  end

  after do
    subject.create(project)
  end

  it 'creates project lib dir' do
    expect(subject).to receive(:empty_directory).with(File.join(project, 'lib', project))
  end

  %w(unit integration acceptance).each do |dir|
    it "creates spec/#{dir}/lib/project" do
      expect(subject).to receive(:empty_directory).with(File.join(project, 'spec', dir, 'lib', project))
    end

    it "creates spec/#{dir}/lib/commands" do
      expect(subject).to receive(:empty_directory).with(File.join(project, 'spec', dir, 'lib/commands'))
    end
  end
end

RSpec.describe ProjecterCLI do
  describe '#create_project_dirs' do
    let(:project) { 'test_project' }

    before do
      allow(subject).to receive(:empty_directory).and_return(true)
    end

    context 'when in library mode' do
      it_behaves_like 'a library'
    end

    context 'when not in library mode' do
      it_behaves_like 'a library'
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
projecter-0.1.2 spec/lib/commands/create_spec.rb
projecter-0.1.1 spec/lib/commands/create_spec.rb