describe 'xcbootstrap for a sample project' do before(:all) do @test_output_directory = File.join(File.dirname(__FILE__), '../../test_output') @bootstrap_output = File.join(@test_output_directory, '/Output') @xcbootstrap = File.expand_path(File.join(File.dirname(__FILE__), '../../bin/xcbootstrap')) end context 'with full option names' do before(:all) do FileUtils.rm_rf @test_output_directory @xcbootstrap_result = system("#{@xcbootstrap} --template Sample --project #{@bootstrap_output}") end it 'should run successfully' do @xcbootstrap_result.should be_true end it 'should have created the output directory' do File.exists?(@bootstrap_output).should be_true end it 'should have created source and test directories' do File.directory?(File.join(@bootstrap_output, "Output")).should be_true File.directory?(File.join(@bootstrap_output, "OutputTests")).should be_true end it 'should have created all the project files' do output_files = Dir.glob("#{@bootstrap_output}/**/{.*,*}").select { |file| !File.directory?(file) } output_files.size.should == 13 end it 'should have the git ignore file renamed' do File.exists?(File.join(@bootstrap_output, ".gitignore")).should be_true end it 'should have replaced the template with the project name' do content = File.read(File.join(@bootstrap_output, "Output.xcodeproj/project.pbxproj")) content.should_not include("Sample") content.should include("Output") end end context 'with short option names' do before(:all) do FileUtils.rm_rf @test_output_directory @xcbootstrap_result = system("#{@xcbootstrap} -t Sample -p #{@bootstrap_output}") end it 'should run successfully' do @xcbootstrap_result.should be_true end it 'should have created the output directory' do File.exists?(@bootstrap_output).should be_true end end end