diff options
author | José Valim <jose.valim@plataformatec.com.br> | 2012-03-19 13:15:15 +0100 |
---|---|---|
committer | José Valim <jose.valim@plataformatec.com.br> | 2012-03-20 10:50:31 +0100 |
commit | 6ef6e7514d0e2071585a397d51a93dd26d44ab3c (patch) | |
tree | 9fe40abb01ed1f86c57ad9845f92c8081e7eeab3 /spec/cache | |
parent | 9ccaf91e2aacfd4c629f36bb05a80d94b4c5e791 (diff) | |
download | bundler-6ef6e7514d0e2071585a397d51a93dd26d44ab3c.tar.gz |
Path and Git should also be packaged.
Diffstat (limited to 'spec/cache')
-rw-r--r-- | spec/cache/git_spec.rb | 68 | ||||
-rw-r--r-- | spec/cache/path_spec.rb | 13 |
2 files changed, 77 insertions, 4 deletions
diff --git a/spec/cache/git_spec.rb b/spec/cache/git_spec.rb index 42c3ad57b9..5d8aa48363 100644 --- a/spec/cache/git_spec.rb +++ b/spec/cache/git_spec.rb @@ -1,4 +1,5 @@ require "spec_helper" + describe "bundle cache with git" do it "base_name should strip private repo uris" do source = Bundler::Source::Git.new("uri" => "git@github.com:bundler.git") @@ -9,4 +10,69 @@ describe "bundle cache with git" do source = Bundler::Source::Git.new("uri" => "//MachineName/ShareFolder") source.send(:base_name).should == "ShareFolder" end - end + + it "copies repository to vendor cache" do + git = build_git "foo" + ref = git.ref_for("master", 11) + + install_gemfile <<-G + gem "foo", :git => '#{lib_path("foo-1.0")}' + G + + bundle "cache" + bundled_app("vendor/cache/foo-1.0-#{ref}").should exist + bundled_app("vendor/cache/foo-1.0-#{ref}/.git").should_not exist + + FileUtils.rm_rf lib_path("foo-1.0") + out.should == "Updating .gem files in vendor/cache" + should_be_installed "foo 1.0" + end + + it "ignores local repository in favor of the cache" do + git = build_git "foo" + ref = git.ref_for("master", 11) + + build_git "foo", :path => lib_path('local-foo') do |s| + s.write "lib/foo.rb", "raise :FAIL" + end + + install_gemfile <<-G + gem "foo", :git => '#{lib_path("foo-1.0")}', :branch => :master + G + + bundle "cache" + bundle %|config local.foo #{lib_path('local-foo')}| + + bundle :install + out.should =~ /at #{bundled_app("vendor/cache/foo-1.0-#{ref}")}/ + + should_be_installed "foo 1.0" + end + + it "copies repository to vendor cache, including submodules" do + build_git "submodule", "1.0" + + git = build_git "has_submodule", "1.0" do |s| + s.add_dependency "submodule" + end + + Dir.chdir(lib_path('has_submodule-1.0')) do + `git submodule add #{lib_path('submodule-1.0')} submodule-1.0` + `git commit -m "submodulator"` + end + + install_gemfile <<-G + git "#{lib_path('has_submodule-1.0')}", :submodules => true do + gem "has_submodule" + end + G + + ref = git.ref_for("master", 11) + bundle "cache" + + bundled_app("vendor/cache/has_submodule-1.0-#{ref}").should exist + bundled_app("vendor/cache/has_submodule-1.0-#{ref}/submodule-1.0").should exist + out.should == "Updating .gem files in vendor/cache" + should_be_installed "has_submodule 1.0" + end +end diff --git a/spec/cache/path_spec.rb b/spec/cache/path_spec.rb index 6a78ac3b5e..343a8f5d32 100644 --- a/spec/cache/path_spec.rb +++ b/spec/cache/path_spec.rb @@ -2,7 +2,7 @@ require "spec_helper" describe "bundle cache" do describe "with path sources" do - it "is silent when the path is within the bundle" do + it "is no-op when the path is within the bundle" do build_lib "foo", :path => bundled_app("lib/foo") install_gemfile <<-G @@ -10,10 +10,13 @@ describe "bundle cache" do G bundle "cache" + bundled_app("vendor/cache/foo-1.0").should_not exist + out.should == "Updating .gem files in vendor/cache" + should_be_installed "foo 1.0" end - it "warns when the path is outside of the bundle" do + it "copies when the path is outside the bundle " do build_lib "foo" install_gemfile <<-G @@ -21,7 +24,11 @@ describe "bundle cache" do G bundle "cache" - out.should include("foo at `#{lib_path("foo-1.0")}` will not be cached") + bundled_app("vendor/cache/foo-1.0").should exist + + FileUtils.rm_rf lib_path("foo-1.0") + out.should == "Updating .gem files in vendor/cache" + should_be_installed "foo 1.0" end end end |