spec/unit/bootstrap_spec.rb in xcbootstrap-0.0.3 vs spec/unit/bootstrap_spec.rb in xcbootstrap-0.1.0

- old
+ new

@@ -4,39 +4,39 @@ describe 'Bootstrap' do include FakeFS::SpecHelpers context 'with a template that does not exist' do it 'should raise an error' do - expect { XCBootstrap::Bootstrap.new("/tmp", "non_existant_template", "path-to-project") }.to raise_error + expect { Bootstrap.new("/tmp", "non_existant_template", "path-to-project") }.to raise_error end end context 'with a template with no manifest' do it 'should raise an error' do FileUtils.mkdir_p "/tmp/template_with_no_manifest" - expect { XCBootstrap::Bootstrap.new("/tmp", "template_with_no_manifest", "path-to-project") }.to raise_error + expect { Bootstrap.new("/tmp", "template_with_no_manifest", "path-to-project") }.to raise_error end end context 'with an invalid manifest file' do it 'should raise an error' do create_invalid_manifest_with_content "fake manifest..\n... the end" - expect { XCBootstrap::Bootstrap.new("/tmp", "template_with_invalid_manifest", "path-to-project") }.to raise_error + expect { Bootstrap.new("/tmp", "template_with_invalid_manifest", "path-to-project") }.to raise_error end end context 'with a manifest where files is not an array' do it 'should raise an error' do create_invalid_manifest_with_content "---\nfiles: blah" - expect { XCBootstrap::Bootstrap.new("/tmp", "template_with_invalid_manifest", "path-to-project") }.to raise_error + expect { Bootstrap.new("/tmp", "template_with_invalid_manifest", "path-to-project") }.to raise_error end end context 'with a manifest where files is empty' do it 'should raise an error' do create_invalid_manifest_with_content "---\nfiles: []" - expect { XCBootstrap::Bootstrap.new("/tmp", "template_with_invalid_manifest", "path-to-project") }.to raise_error + expect { Bootstrap.new("/tmp", "template_with_invalid_manifest", "path-to-project") }.to raise_error end end context 'with a valid template' do before(:each) do @@ -49,15 +49,15 @@ File.open "/tmp/my_template/some_file.txt", "w" do |from_file| from_file.puts "some content" end - Dir.stub(:getwd).and_return("/tmp") + Dir.stub(:pwd).and_return("/tmp/fake-working-dir") end context 'with a relative project path' do - let(:bootstrapper) { XCBootstrap::Bootstrap.new("/tmp", "my_template", "../tmp/path/to/my_project") } + let(:bootstrapper) { Bootstrap.new("/tmp", "my_template", "../path/to/my_project") } it 'should have the full path to the template' do bootstrapper.template_dir.should == "/tmp/my_template" end @@ -66,10 +66,11 @@ end context 'when the template is processed' do before(:each) do File.stub(:binary?).and_return(false) + File.stub(:image?).and_return(false) bootstrapper.process end it 'should create the output project directory' do File.exists?(bootstrapper.project_dir).should be_true @@ -81,10 +82,10 @@ end end end context 'with an absolute project path' do - let(:bootstrapper) { XCBootstrap::Bootstrap.new("/tmp", "my_template", "/tmp/path/to/my_project") } + let(:bootstrapper) { Bootstrap.new("/tmp", "my_template", "/tmp/path/to/my_project") } it 'should leave the project path absolute' do bootstrapper.project_dir.should == "/tmp/path/to/my_project" end end