summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndre Arko <andre@arko.net>2011-05-05 12:36:33 -0700
committerAndre Arko <andre@arko.net>2011-05-05 12:36:33 -0700
commit23ba3276873c5b7d2e9afd71a96aeba433182dc9 (patch)
tree1dbfc821735a27c4c14cdab045318b51978f3440
parente1e588e6b6bec6c3287ed56d24b0750130eb3af3 (diff)
downloadbundler-23ba3276873c5b7d2e9afd71a96aeba433182dc9.tar.gz
fix the huge ugly bug I made that breaks install, add specs
-rw-r--r--lib/bundler/source.rb6
-rw-r--r--spec/bundler/source_spec.rb25
2 files changed, 28 insertions, 3 deletions
diff --git a/lib/bundler/source.rb b/lib/bundler/source.rb
index 93aaca7b83..48f281607e 100644
--- a/lib/bundler/source.rb
+++ b/lib/bundler/source.rb
@@ -10,7 +10,7 @@ module Bundler
module Source
# TODO: Refactor this class
class Rubygems
- attr_reader :remotes
+ attr_reader :remotes, :caches
def initialize(options = {})
@options = options
@@ -19,8 +19,8 @@ module Bundler
@allow_remote = false
@allow_cached = false
- @caches = [ Bundler.app_cache ]
- @caches << Bundler.rubygems.gem_path.map{|p| File.expand_path("#{p}/cache") }
+ @caches = [ Bundler.app_cache ] +
+ Bundler.rubygems.gem_path.map{|p| File.expand_path("#{p}/cache") }
@spec_fetch_map = {}
end
diff --git a/spec/bundler/source_spec.rb b/spec/bundler/source_spec.rb
new file mode 100644
index 0000000000..41440f1075
--- /dev/null
+++ b/spec/bundler/source_spec.rb
@@ -0,0 +1,25 @@
+require 'spec_helper'
+
+describe Bundler::Source::Rubygems do
+ before do
+ Bundler.stub(:root){ Pathname.new("root") }
+ end
+
+ describe "caches" do
+ it "should include Bundler.app_cache" do
+ subject.caches.should include(Bundler.app_cache)
+ end
+
+ it "should include GEM_PATH entries" do
+ Gem.path.each do |path|
+ subject.caches.should include(File.expand_path("#{path}/cache"))
+ end
+ end
+
+ it "should be an array of strings or pathnames" do
+ subject.caches.each do |cache|
+ [String, Pathname].should include(cache.class)
+ end
+ end
+ end
+end