summaryrefslogtreecommitdiff
path: root/spec/bundler/yaml_serializer_spec.rb
diff options
context:
space:
mode:
authorAsutosh Palai <asupalai@gmail.com>2016-06-09 13:47:02 +0530
committerAsutosh Palai <asupalai@gmail.com>2016-06-09 13:47:16 +0530
commit8e6aab8395d0a6855886cbda8833a7f01f980298 (patch)
treedd88ee577f2b31484147008398f61d68edbe32f3 /spec/bundler/yaml_serializer_spec.rb
parent3ddce71274da2ec529685635d90cc7a208b840c9 (diff)
downloadbundler-8e6aab8395d0a6855886cbda8833a7f01f980298.tar.gz
Made yaml_serializer compatible for use with settings
Diffstat (limited to 'spec/bundler/yaml_serializer_spec.rb')
-rw-r--r--spec/bundler/yaml_serializer_spec.rb34
1 files changed, 22 insertions, 12 deletions
diff --git a/spec/bundler/yaml_serializer_spec.rb b/spec/bundler/yaml_serializer_spec.rb
index c15c67552b..59906deb81 100644
--- a/spec/bundler/yaml_serializer_spec.rb
+++ b/spec/bundler/yaml_serializer_spec.rb
@@ -3,10 +3,12 @@ require "spec_helper"
require "bundler/yaml_serializer"
describe Bundler::YAMLSerializer do
+ subject(:serializer) { Bundler::YAMLSerializer }
+
describe "#dump" do
it "works for simple hash" do
- hash = {"Q" => "Where does Thursday come before Wednesday?",
- "Ans" => "In the dictionary. :P"}
+ hash = { "Q" => "Where does Thursday come before Wednesday?",
+ "Ans" => "In the dictionary. :P" }
expected = strip_whitespace <<-YAML
---
@@ -14,16 +16,16 @@ describe Bundler::YAMLSerializer do
Ans: "In the dictionary. :P"
YAML
- expect(subject.dump(hash)).to eq(expected)
+ expect(serializer.dump(hash)).to eq(expected)
end
it "handles nested hash" do
hash = {
"a_joke" => {
"my-stand" => "I can totally keep secrets",
- "my-explanation" => "It's the people I tell them to that can't"
+ "my-explanation" => "It's the people I tell them to that can't",
},
- "read_ahead" => "All generalizations are false, including this one"
+ "read_ahead" => "All generalizations are false, including this one",
}
expected = strip_whitespace <<-YAML
@@ -34,7 +36,7 @@ describe Bundler::YAMLSerializer do
read_ahead: "All generalizations are false, including this one"
YAML
- expect(subject.dump(hash)).to eq(expected)
+ expect(serializer.dump(hash)).to eq(expected)
end
end
@@ -48,10 +50,10 @@ describe Bundler::YAMLSerializer do
hash = {
"Jon" => "Air is free dude!",
- "Jack" => "Yes.. until you buy a bag of chips!"
+ "Jack" => "Yes.. until you buy a bag of chips!",
}
- expect(subject.load(yaml)).to eq(hash)
+ expect(serializer.load(yaml)).to eq(hash)
end
it "works for nested hash" do
@@ -66,13 +68,21 @@ describe Bundler::YAMLSerializer do
hash = {
"baa" => {
"baa" => "black sheep",
- "have"=>"you any wool?",
- "yes"=>"merry have I"
+ "have" => "you any wool?",
+ "yes" => "merry have I",
},
- "three"=>"bags full"
+ "three" => "bags full",
}
- expect(subject.load(yaml)).to eq(hash)
+ expect(serializer.load(yaml)).to eq(hash)
+ end
+
+ it "handles colon in key/value" do
+ yaml = strip_whitespace <<-YAML
+ BUNDLE_MIRROR__HTTPS://RUBYGEMS__ORG/: http://rubygems-mirror.org
+ YAML
+
+ expect(serializer.load(yaml)).to eq("BUNDLE_MIRROR__HTTPS://RUBYGEMS__ORG/" => "http://rubygems-mirror.org")
end
end
end