Sha256: 0ce05cad004c368ae94d7a8492e830c04d9f4dc2b2e291862e687d9ed18d8e83

Contents?: true

Size: 1.18 KB

Versions: 3

Compression:

Stored size: 1.18 KB

Contents

require_relative '../spec_helper'

describe 'Cli' do
  before(:each) do
    fake_boostrap = mock().as_null_object
    XCBootstrap::Bootstrap.stub(:new).and_return(fake_boostrap)
  end
  
  context 'with the template and project arguments' do
    it 'should point to the default template dir' do
      default_template_dir = File.expand_path("templates")
      XCBootstrap::Bootstrap.should_receive(:new).with(default_template_dir, anything, anything)
      XCBootstrap::Cli.new("", {}).run(["--template", "MyTemplate", "--project", "../MyProject"])
    end
    
    it 'should bootstrap the project from the template' do
      XCBootstrap::Bootstrap.should_receive(:new).with(anything, "MyTemplate", "../MyProject")
      XCBootstrap::Cli.new("", {}).run(["--template", "MyTemplate", "--project", "../MyProject"])
    end
  end
  
  context 'without the template flag' do
    it 'should raise an error' do
      expect { XCBootstrap::Cli.new("", {}).run(["--project", "../MyProject"]) }.to raise_error
    end
  end
  
  context 'without the project flag' do
    it 'should raise an error' do
      expect { XCBootstrap::Cli.new("", {}).run(["--template", "MyTemplate"]) }.to raise_error
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
xcbootstrap-0.0.3 spec/unit/cli_spec.rb
xcbootstrap-0.0.2 spec/unit/cli_spec.rb
xcbootstrap-0.0.1 spec/unit/cli_spec.rb