summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2023-10-24 16:22:58 +0900
committergit <svn-admin@ruby-lang.org>2023-10-24 16:31:43 +0000
commit5c4978c11c4ea9569d5d99a86936fbef0ab7fa52 (patch)
tree0300dfa2a7e7d529573c71debda64e69b02fd0a7 /spec
parentc86c6a84f53a21330702ebd21cc1a65d7776171d (diff)
[rubygems/rubygems] Handle empty array
https://github.com/rubygems/rubygems/commit/7c0afdd9af
Diffstat (limited to 'spec')
-rw-r--r--spec/bundler/bundler/yaml_serializer_spec.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/spec/bundler/bundler/yaml_serializer_spec.rb b/spec/bundler/bundler/yaml_serializer_spec.rb
index da4aa52829..913b0235b8 100644
--- a/spec/bundler/bundler/yaml_serializer_spec.rb
+++ b/spec/bundler/bundler/yaml_serializer_spec.rb
@@ -57,6 +57,19 @@ RSpec.describe Bundler::YAMLSerializer do
expect(serializer.dump(hash)).to eq(expected)
end
+
+ it "handles empty array" do
+ hash = {
+ "empty_array" => [],
+ }
+
+ expected = <<~YAML
+ ---
+ empty_array: []
+ YAML
+
+ expect(serializer.dump(hash)).to eq(expected)
+ end
end
describe "#load" do
@@ -148,6 +161,19 @@ RSpec.describe Bundler::YAMLSerializer do
expect(serializer.load(yaml)).to eq(hash)
end
+
+ it "handles empty array" do
+ yaml = <<~YAML
+ ---
+ empty_array: []
+ YAML
+
+ hash = {
+ "empty_array" => [],
+ }
+
+ expect(serializer.load(yaml)).to eq(hash)
+ end
end
describe "against yaml lib" do