diff options
author | Stefan Huber <MSNexploder@gmail.com> | 2014-04-22 22:26:12 +0200 |
---|---|---|
committer | Stefan Huber <MSNexploder@gmail.com> | 2014-04-22 22:26:12 +0200 |
commit | 2c356be90a23921058cd14fd0e4a366da195021a (patch) | |
tree | db4d50937248dc0637eb28f33151f5a5dded05dc /spec/cache | |
parent | 068d2aef98034f748377e6e1f1bba1c5141aae39 (diff) | |
download | bundler-2c356be90a23921058cd14fd0e4a366da195021a.tar.gz |
svn source support
Diffstat (limited to 'spec/cache')
-rw-r--r-- | spec/cache/gems_spec.rb | 32 | ||||
-rw-r--r-- | spec/cache/svn_spec.rb | 82 |
2 files changed, 114 insertions, 0 deletions
diff --git a/spec/cache/gems_spec.rb b/spec/cache/gems_spec.rb index 3ba98b7730..75158c451b 100644 --- a/spec/cache/gems_spec.rb +++ b/spec/cache/gems_spec.rb @@ -137,6 +137,38 @@ describe "bundle cache" do end end + describe "when there are also svn sources" do + before do + build_svn "foo" + system_gems "rack-1.0.0" + + install_gemfile <<-G + source "file://#{gem_repo1}" + svn "file://#{lib_path("foo-1.0")}" do + gem 'foo' + end + gem 'rack' + G + end + + it "still works" do + bundle :cache + + system_gems [] + bundle "install --local" + + should_be_installed("rack 1.0.0", "foo 1.0") + end + + it "should not explode if the lockfile is not present" do + FileUtils.rm(bundled_app("Gemfile.lock")) + + bundle :cache + + expect(bundled_app("Gemfile.lock")).to exist + end + end + describe "when previously cached" do before :each do build_repo2 diff --git a/spec/cache/svn_spec.rb b/spec/cache/svn_spec.rb new file mode 100644 index 0000000000..e798e0e9a2 --- /dev/null +++ b/spec/cache/svn_spec.rb @@ -0,0 +1,82 @@ +require "spec_helper" + +%w(cache package).each do |cmd| + describe "bundle #{cmd} with svn" do + it "copies repository to vendor cache and uses it" do + svn = build_svn "foo" + ref = svn.ref_for("HEAD") + + install_gemfile <<-G + gem "foo", :svn => 'file://#{lib_path("foo-1.0")}' + G + + bundle "#{cmd} --all" + expect(bundled_app("vendor/cache/foo-1.0-#{ref}")).to exist + expect(bundled_app("vendor/cache/foo-1.0-#{ref}/.svn")).to exist + + FileUtils.rm_rf lib_path("foo-1.0") + should_be_installed "foo 1.0" + end + + it "copies repository to vendor cache and uses it even when installed with bundle --path" do + svn = build_svn "foo" + ref = svn.ref_for("HEAD") + + install_gemfile <<-G + gem "foo", :svn => 'file://#{lib_path("foo-1.0")}' + G + + bundle "install --path vendor/bundle" + bundle "#{cmd} --all" + + expect(bundled_app("vendor/cache/foo-1.0-#{ref}")).to exist + expect(bundled_app("vendor/cache/foo-1.0-#{ref}/.svn")).to exist + + FileUtils.rm_rf lib_path("foo-1.0") + should_be_installed "foo 1.0" + end + + it "runs twice without exploding" do + build_svn "foo" + + install_gemfile <<-G + gem "foo", :svn => 'file://#{lib_path("foo-1.0")}' + G + + bundle "#{cmd} --all" + bundle "#{cmd} --all" + + expect(err).to eq("") + FileUtils.rm_rf lib_path("foo-1.0") + should_be_installed "foo 1.0" + end + + it "tracks updates" do + svn = build_svn "foo" + old_ref = svn.ref_for("HEAD") + + install_gemfile <<-G + gem "foo", :svn => 'file://#{lib_path("foo-1.0")}' + G + + bundle "#{cmd} --all" + + update_svn "foo" do |s| + s.write "lib/foo.rb", "puts :CACHE" + end + + ref = svn.ref_for("HEAD") + expect(ref).not_to eq(old_ref) + + bundle "update" + bundle "#{cmd} --all" + + expect(bundled_app("vendor/cache/foo-1.0-#{ref}")).to exist + + FileUtils.rm_rf lib_path("foo-1.0") + run "require 'foo'" + expect(out).to eq("CACHE") + end + + end +end |