diff options
author | Terence Lee <hone02@gmail.com> | 2012-12-27 22:47:00 -0500 |
---|---|---|
committer | Terence Lee <hone02@gmail.com> | 2012-12-27 22:47:00 -0500 |
commit | 885ed215c21575bcb264038543c9834bb4a98744 (patch) | |
tree | 37bdba187d771357e6d7ed558c27e188875f19db /spec | |
parent | dd11095592351c6c8b6f0f7866f4f1d80ebda60f (diff) | |
download | bundler-885ed215c21575bcb264038543c9834bb4a98744.tar.gz |
handle the case where the binstub already exists, also --force
Diffstat (limited to 'spec')
-rw-r--r-- | spec/other/binstubs_spec.rb | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/spec/other/binstubs_spec.rb b/spec/other/binstubs_spec.rb index faab6c0a..2a14241f 100644 --- a/spec/other/binstubs_spec.rb +++ b/spec/other/binstubs_spec.rb @@ -92,4 +92,43 @@ describe "bundle binstubs <gem>" do expect(bundled_app("exec/rails")).to exist end end + + context "when the bin already exists" do + it "don't override it and warn" do + FileUtils.mkdir_p(bundled_app("bin")) + File.open(bundled_app("bin/rackup"), 'wb') do |file| + file.print "OMG" + end + + install_gemfile <<-G + source "file://#{gem_repo1}" + gem "rack" + G + + bundle "binstubs rack" + + expect(bundled_app("bin/rackup")).to exist + expect(File.read(bundled_app("bin/rackup"))).to eq("OMG") + expect(out).to eq("Skipping rackup, since it already exists.") + end + + context "when using --force" do + it "overrides the binstub" do + FileUtils.mkdir_p(bundled_app("bin")) + File.open(bundled_app("bin/rackup"), 'wb') do |file| + file.print "OMG" + end + + install_gemfile <<-G + source "file://#{gem_repo1}" + gem "rack" + G + + bundle "binstubs rack --force" + + expect(bundled_app("bin/rackup")).to exist + expect(File.read(bundled_app("bin/rackup"))).not_to eq("OMG") + end + end + end end |