summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordanielsdeleo <dan@opscode.com>2013-03-06 11:57:45 -0800
committerjoyicecloud <joyicecloud@gmail.com>2013-09-26 16:48:35 -0700
commit42922ef5006e2a984b01e63fa90b11ccd64cf2a3 (patch)
tree27df48d5c048a22452cb37065bce245e2827b766
parent0dd5cb879853f7de3b17752978dffccdd24ae24a (diff)
downloadbundler-42922ef5006e2a984b01e63fa90b11ccd64cf2a3.tar.gz
add specs for gem mirror support
-rw-r--r--spec/commands/config_spec.rb14
-rw-r--r--spec/install/gems/mirror_spec.rb36
2 files changed, 50 insertions, 0 deletions
diff --git a/spec/commands/config_spec.rb b/spec/commands/config_spec.rb
index 100889bce7..6c5a2c3707 100644
--- a/spec/commands/config_spec.rb
+++ b/spec/commands/config_spec.rb
@@ -178,4 +178,18 @@ describe ".bundle/config" do
expect(out).to eq("false")
end
end
+
+ describe "gem mirrors" do
+ before(:each) { bundle :install }
+
+ it "configures mirrors using keys with `mirror.`" do
+ bundle "config --local mirror.http://gems.example.org http://gem-mirror.example.org"
+ run(<<-E)
+Bundler.settings.gem_mirrors.each do |k, v|
+ puts "\#{k} => \#{v}"
+end
+E
+ expect(out).to eq("http://gems.example.org/ => http://gem-mirror.example.org/")
+ end
+ end
end
diff --git a/spec/install/gems/mirror_spec.rb b/spec/install/gems/mirror_spec.rb
new file mode 100644
index 0000000000..6d18e30f0e
--- /dev/null
+++ b/spec/install/gems/mirror_spec.rb
@@ -0,0 +1,36 @@
+require "spec_helper"
+
+describe "bundle install with a mirror configured" do
+ describe "when the mirror does not match the gem source" do
+ before :each do
+ gemfile <<-G
+ source "file://#{gem_repo1}"
+
+ gem "rack"
+ G
+ bundle "config --local mirror.http://gems.example.org http://gem-mirror.example.org"
+ end
+
+ it "installs from the normal location" do
+ bundle :install
+ should_be_installed "rack 1.0"
+ end
+ end
+
+ describe "when the gem source matches a configured mirror" do
+ before :each do
+ gemfile <<-G
+ # This source is bogus and doesn't have the gem we're looking for
+ source "file://#{gem_repo2}"
+
+ gem "rack"
+ G
+ bundle "config --local mirror.file://#{gem_repo2} file://#{gem_repo1}"
+ end
+
+ it "installs the gem from the mirror" do
+ bundle :install
+ should_be_installed "rack 1.0"
+ end
+ end
+end