diff options
Diffstat (limited to 'spec/bundler/bundler/settings_spec.rb')
-rw-r--r-- | spec/bundler/bundler/settings_spec.rb | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/spec/bundler/bundler/settings_spec.rb b/spec/bundler/bundler/settings_spec.rb index 24e3de7ba8..634e0faf91 100644 --- a/spec/bundler/bundler/settings_spec.rb +++ b/spec/bundler/bundler/settings_spec.rb @@ -27,7 +27,7 @@ RSpec.describe Bundler::Settings do "gem.mit" => "false", "gem.test" => "minitest", "thingy" => <<-EOS.tr("\n", " "), ---asdf --fdsa --ty=oh man i hope this doesnt break bundler because +--asdf --fdsa --ty=oh man i hope this doesn't break bundler because that would suck --ehhh=oh geez it looks like i might have broken bundler somehow --very-important-option=DontDeleteRoo --very-important-option=DontDeleteRoo @@ -131,7 +131,7 @@ that would suck --ehhh=oh geez it looks like i might have broken bundler somehow Bundler.settings.set_command_option :no_install, true - Bundler.settings.temporary(:no_install => false) do + Bundler.settings.temporary(no_install: false) do expect(Bundler.settings[:no_install]).to eq false end @@ -147,12 +147,12 @@ that would suck --ehhh=oh geez it looks like i might have broken bundler somehow context "when called without a block" do it "leaves the setting changed" do - Bundler.settings.temporary(:foo => :random) + Bundler.settings.temporary(foo: :random) expect(Bundler.settings[:foo]).to eq "random" end it "returns nil" do - expect(Bundler.settings.temporary(:foo => :bar)).to be_nil + expect(Bundler.settings.temporary(foo: :bar)).to be_nil end end end @@ -179,7 +179,7 @@ that would suck --ehhh=oh geez it looks like i might have broken bundler somehow end describe "#mirror_for" do - let(:uri) { Bundler::URI("https://rubygems.org/") } + let(:uri) { Gem::URI("https://rubygems.org/") } context "with no configured mirror" do it "returns the original URI" do @@ -192,7 +192,7 @@ that would suck --ehhh=oh geez it looks like i might have broken bundler somehow end context "with a configured mirror" do - let(:mirror_uri) { Bundler::URI("https://rubygems-mirror.org/") } + let(:mirror_uri) { Gem::URI("https://rubygems-mirror.org/") } before { settings.set_local "mirror.https://rubygems.org/", mirror_uri.to_s } @@ -213,7 +213,7 @@ that would suck --ehhh=oh geez it looks like i might have broken bundler somehow end context "with a file URI" do - let(:mirror_uri) { Bundler::URI("file:/foo/BAR/baz/qUx/") } + let(:mirror_uri) { Gem::URI("file:/foo/BAR/baz/qUx/") } it "returns the mirror URI" do expect(settings.mirror_for(uri)).to eq(mirror_uri) @@ -231,7 +231,7 @@ that would suck --ehhh=oh geez it looks like i might have broken bundler somehow end describe "#credentials_for" do - let(:uri) { Bundler::URI("https://gemserver.example.org/") } + let(:uri) { Gem::URI("https://gemserver.example.org/") } let(:credentials) { "username:password" } context "with no configured credentials" do @@ -291,7 +291,7 @@ that would suck --ehhh=oh geez it looks like i might have broken bundler somehow it "reads older keys without trailing slashes" do settings.set_local "mirror.https://rubygems.org", "http://rubygems-mirror.org" expect(settings.mirror_for("https://rubygems.org/")).to eq( - Bundler::URI("http://rubygems-mirror.org/") + Gem::URI("http://rubygems-mirror.org/") ) end @@ -319,6 +319,15 @@ that would suck --ehhh=oh geez it looks like i might have broken bundler somehow expect(settings["mirror.https://rubygems.org/"]).to eq("http://rubygems-mirror.org") end + it "ignores commented out keys" do + create_file bundled_app(".bundle/config"), <<~C + # BUNDLE_MY-PERSONAL-SERVER__ORG: my-personal-server.org + C + + expect(Bundler.ui).not_to receive(:warn) + expect(settings.all).to be_empty + end + it "converts older keys with dashes" do config("BUNDLE_MY-PERSONAL-SERVER__ORG" => "my-personal-server.org") expect(Bundler.ui).to receive(:warn).with( |