Sha256: 58c76e2d3046badf20dd80a19fc66c8bd37f752ac895affc8d885002457d1225

Contents?: true

Size: 948 Bytes

Versions: 2

Compression:

Stored size: 948 Bytes

Contents

require 'open3'
require 'spec_helper'

include PlanterHelpers

describe 'CLI' do
  TEST_DIR = File.join(File.dirname(__FILE__), 'test')

  before do
    FileUtils.rm_rf(TEST_DIR)
    FileUtils.mkdir_p(TEST_DIR)
  end

  after do
    FileUtils.rm_rf(TEST_DIR)
  end

  it 'displays help message' do
    output, stderr, status = planter('--help')
    expect(output).to match(/Usage: plant \[options\] TEMPLATE/)
  end

  it 'displays variables for a template' do
    output, stderr, status = planter('--help', 'test')
    expect(output).to match(/CLI Prompt/)
  end

  it 'plants a new project' do
    output, stderr, status = planter("--in=#{TEST_DIR}", 'test')
    expect(File.exist?(File.join(TEST_DIR, 'bollocks_and_beans.rtf'))).to be true
  end

  it 'plants a new file with a script' do
    output, stderr, status = planter("--in=#{TEST_DIR}", 'test')
    expect(File.exist?(File.join(TEST_DIR, 'planted_by_script.txt'))).to be true
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
planter-cli-3.0.7 spec/cli_spec.rb
planter-cli-3.0.5 spec/cli_spec.rb