require_relative 'spec_helper' require 'stringio' describe Vagrant::Templated::Command::Init do before :context do @tmp = File.join File.dirname(__FILE__), 'tmp' end before :example do @cwd = File.join @tmp, SecureRandom.urlsafe_base64 FileUtils.mkdir_p @cwd @env = Vagrant::Environment.new cwd: @cwd @vagrantfile = File.join @cwd, 'Vagrantfile' @berksfile = File.join @cwd, 'Berksfile' end after :example do FileUtils.rm_rf @cwd end it 'should have a version number' do expect(::Vagrant::Templated::VERSION).to be_truthy end it 'should display help whitout any argument' do expect{ described_class.new([], @env).execute }.to raise_error Vagrant::Errors::CLIInvalidUsage end context 'when asking for help' do it 'should display usage' do usage = /Usage: vagrant templated init \[options\]