Sha256: 55981a9e80b6e08938ecf11e3b68db18acf5d70992301a73d1c19975f3f4ad6d

Contents?: true

Size: 1.74 KB

Versions: 37

Compression:

Stored size: 1.74 KB

Contents

require File.expand_path("spec_helper", File.dirname(__FILE__))
require File.dirname(__FILE__) + '/../lib/capify'

describe 'loading everything' do
  def run_cap(folder,task)
    folder = File.join(File.dirname(__FILE__),'cap',folder)
    `cd #{folder} && #{task}`
  end

  it "finds all tasks" do
    tasks = run_cap 'all', 'cap -T'
    tasks.split("\n").size.should >= 20
  end
end

describe "cap-recipes command" do
  
  before(:all) do
    @test_path = 'test/'
    @cap_recipes = CapRecipes.dup
    @cap_file = File.join @test_path, 'Capfile'
    @deploy_file = File.join @test_path, 'config/deploy.rb'
  end
  
  after(:each) do
    `rm -rf #{@test_path}`
  end
  
  it "should show the description on --help" do
    capture(:stdout) { @cap_recipes.start(['--help']) }.should match(/Usage/)
  end
  
  it "should show the list of recipes" do
    capture(:stdout) { @cap_recipes.start(['--list']) }.should match(/Available Recipes/)
  end
  
  it "should generate Capfile and config/deploy.rb" do
    capture(:stdout) { @cap_recipes.start([@test_path]) }.should match(/create/)
    File.exists?(@cap_file).should be_true
    File.exists?(@deploy_file).should be_true
  end
  
  it "should generate deploy.rb with apache" do
    capture(:stdout) { @cap_recipes.start([@test_path,'apache']) }.should match(/create/)
    File.open(@deploy_file).read.should match(/require \'cap_recipes\/tasks\/apache\'/)
  end
  
  it "should generate deploy.rb with passenger and gitosis" do
    capture(:stdout) { @cap_recipes.start([@test_path,"passenger","gitosis"]) }.should match(/create/)
    response = File.open(@deploy_file).read
    response.should match(/require \'cap_recipes\/tasks\/passenger\'/)
    response.should match(/require \'cap_recipes\/tasks\/gitosis\'/)
  end
  
  
end

Version data entries

37 entries across 37 versions & 2 rubygems

Version Path
uhl-cap-recipes-0.2.11 spec/cap_recipes_spec.rb
uhl-cap-recipes-0.2.10 spec/cap_recipes_spec.rb
uhl-cap-recipes-0.1.10 spec/cap_recipes_spec.rb
uhl-cap-recipes-0.1.9 spec/cap_recipes_spec.rb
uhl-cap-recipes-0.1.8 spec/cap_recipes_spec.rb
uhl-cap-recipes-0.1.7 spec/cap_recipes_spec.rb
uhl-cap-recipes-0.1.6 spec/cap_recipes_spec.rb
uhl-cap-recipes-0.1.5 spec/cap_recipes_spec.rb
uhl-cap-recipes-0.1.4 spec/cap_recipes_spec.rb
uhl-cap-recipes-0.1.3 spec/cap_recipes_spec.rb
uhl-cap-recipes-0.1.2 spec/cap_recipes_spec.rb
uhl-cap-recipes-0.1.1 spec/cap_recipes_spec.rb
uhl-cap-recipes-0.1.0 spec/cap_recipes_spec.rb
crazycode-cap-recipes-0.5.3 spec/cap_recipes_spec.rb
crazycode-cap-recipes-0.5.2 spec/cap_recipes_spec.rb
crazycode-cap-recipes-0.5.1 spec/cap_recipes_spec.rb
crazycode-cap-recipes-0.5.0 spec/cap_recipes_spec.rb
crazycode-cap-recipes-0.4.14 spec/cap_recipes_spec.rb
crazycode-cap-recipes-0.4.13 spec/cap_recipes_spec.rb
crazycode-cap-recipes-0.4.12 spec/cap_recipes_spec.rb