spec/cache/path_spec.rb in bundler-1.1.5 vs spec/cache/path_spec.rb in bundler-1.2.0.pre
- old
+ new
@@ -1,27 +1,103 @@
require "spec_helper"
-describe "bundle cache" do
- describe "with path sources" do
- it "is silent when the path is within the bundle" do
+%w(cache package).each do |cmd|
+ describe "bundle #{cmd} with path" do
+ it "is no-op when the path is within the bundle" do
build_lib "foo", :path => bundled_app("lib/foo")
install_gemfile <<-G
gem "foo", :path => '#{bundled_app("lib/foo")}'
G
- bundle "cache"
- out.should == "Updating .gem files in vendor/cache"
+ bundle "#{cmd} --all"
+ bundled_app("vendor/cache/foo-1.0").should_not exist
+ 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
gem "foo", :path => '#{lib_path("foo-1.0")}'
G
- bundle "cache"
- out.should include("foo at `#{lib_path("foo-1.0")}` will not be cached")
+ bundle "#{cmd} --all"
+ bundled_app("vendor/cache/foo-1.0").should exist
+
+ FileUtils.rm_rf lib_path("foo-1.0")
+ should_be_installed "foo 1.0"
end
+
+ it "updates the path on each cache" do
+ build_lib "foo"
+
+ install_gemfile <<-G
+ gem "foo", :path => '#{lib_path("foo-1.0")}'
+ G
+
+ bundle "#{cmd} --all"
+
+ build_lib "foo" do |s|
+ s.write "lib/foo.rb", "puts :CACHE"
+ end
+
+ bundle "#{cmd} --all"
+
+ bundled_app("vendor/cache/foo-1.0").should exist
+ FileUtils.rm_rf lib_path("foo-1.0")
+
+ run "require 'foo'"
+ out.should == "CACHE"
+ end
+
+ it "raises a warning without --all" do
+ build_lib "foo"
+
+ install_gemfile <<-G
+ gem "foo", :path => '#{lib_path("foo-1.0")}'
+ G
+
+ bundle cmd
+ out.should =~ /please pass the \-\-all flag/
+ bundled_app("vendor/cache/foo-1.0").should_not exist
+ end
+
+ it "stores the given flag" do
+ build_lib "foo"
+
+ install_gemfile <<-G
+ gem "foo", :path => '#{lib_path("foo-1.0")}'
+ G
+
+ bundle "#{cmd} --all"
+ build_lib "bar"
+
+ install_gemfile <<-G
+ gem "foo", :path => '#{lib_path("foo-1.0")}'
+ gem "bar", :path => '#{lib_path("bar-1.0")}'
+ G
+
+ bundle cmd
+ bundled_app("vendor/cache/bar-1.0").should exist
+ end
+
+ it "can rewind chosen configuration" do
+ build_lib "foo"
+
+ install_gemfile <<-G
+ gem "foo", :path => '#{lib_path("foo-1.0")}'
+ G
+
+ bundle "#{cmd} --all"
+ build_lib "baz"
+
+ gemfile <<-G
+ gem "foo", :path => '#{lib_path("foo-1.0")}'
+ gem "baz", :path => '#{lib_path("baz-1.0")}'
+ G
+
+ bundle "#{cmd} --no-all"
+ bundled_app("vendor/cache/baz-1.0").should_not exist
+ end
end
-end
+end
\ No newline at end of file