summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHomu <homu@barosl.com>2016-09-01 05:42:29 +0900
committerHomu <homu@barosl.com>2016-09-01 05:42:29 +0900
commitb2fc16380c58e78d897012befd8f978b68bdab95 (patch)
treec358ecd029db974182374742ff6b3d9ad6771722
parent8958d45315f7c18a44c641a3fbd3dcb5c37ac605 (diff)
parent19b5759cff213e80192368685f8c0332c3003cdc (diff)
downloadbundler-b2fc16380c58e78d897012befd8f978b68bdab95.tar.gz
Auto merge of #4938 - JuanitoFatas:patch/settings-spec, r=segiddins
Add some specs for Bundler::Settings#temporary This PR adds a spec and moved an alias in Settings class. followup of #4917.
-rw-r--r--lib/bundler/settings.rb3
-rw-r--r--spec/bundler/settings_spec.rb12
2 files changed, 13 insertions, 2 deletions
diff --git a/lib/bundler/settings.rb b/lib/bundler/settings.rb
index 4d1271df65..bed875420e 100644
--- a/lib/bundler/settings.rb
+++ b/lib/bundler/settings.rb
@@ -83,6 +83,7 @@ module Bundler
local_config_file || raise(GemfileNotFound, "Could not locate Gemfile")
set_key(key, value, @local_config, local_config_file)
end
+ alias_method :set_local, :[]=
def temporary(update)
existing = Hash[update.map {|k, _| [k, @temporary[k]] }]
@@ -95,8 +96,6 @@ module Bundler
end
end
- alias_method :set_local, :[]=
-
def delete(key)
@local_config.delete(key_for(key))
end
diff --git a/spec/bundler/settings_spec.rb b/spec/bundler/settings_spec.rb
index 0f7d2a0138..31ca13903c 100644
--- a/spec/bundler/settings_spec.rb
+++ b/spec/bundler/settings_spec.rb
@@ -96,6 +96,18 @@ that would suck --ehhh=oh geez it looks like i might have broken bundler somehow
end
end
+ describe "#temporary" do
+ it "reset after used" do
+ Bundler.settings[:no_install] = true
+
+ Bundler.settings.temporary(:no_install => false) do
+ expect(Bundler.settings[:no_install]).to eq false
+ end
+
+ expect(Bundler.settings[:no_install]).to eq true
+ end
+ end
+
describe "#set_global" do
context "when it's not possible to write to the file" do
it "raises an PermissionError with explanation" do