moxml 0.1.22 → 0.1.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -105,7 +105,8 @@ RSpec.describe Moxml::Adapter::Libxml do
105
105
 
106
106
  it "returns [nil, nil] when the document has no entity-ref attachments" do
107
107
  root = libxml_native(context.parse("<root><a/></root>").root)
108
- expect(adapter.send(:lookup_entity_ref_serialization, root)).to eq([nil, nil])
108
+ expect(adapter.send(:lookup_entity_ref_serialization,
109
+ root)).to eq([nil, nil])
109
110
  end
110
111
 
111
112
  it "returns [nil, nil] for an element with no entity refs even when the doc has erefs elsewhere" do
@@ -129,7 +130,8 @@ RSpec.describe Moxml::Adapter::Libxml do
129
130
  )
130
131
  a.add_child(eref)
131
132
 
132
- refs, seq = adapter.send(:lookup_entity_ref_serialization, libxml_native(a))
133
+ refs, seq = adapter.send(:lookup_entity_ref_serialization,
134
+ libxml_native(a))
133
135
  expect(refs).to be_an(Array).and(satisfy { |r| !r.empty? })
134
136
  expect(seq).to be_an(Array).and(include(:eref))
135
137
  end
@@ -4,7 +4,8 @@ require "spec_helper"
4
4
 
5
5
  RSpec.describe Moxml::Adapter, ".platform_adapters" do
6
6
  it "includes all known adapters under MRI" do
7
- expect(described_class.platform_adapters).to include(:nokogiri, :oga, :rexml, :ox)
7
+ expect(described_class.platform_adapters).to include(:nokogiri, :oga,
8
+ :rexml, :ox)
8
9
  end
9
10
 
10
11
  it "uses the AVAILABLE_ADAPTERS constant under MRI" do
@@ -10,6 +10,7 @@ RSpec.describe Moxml::Config do
10
10
  expect(config.strict_parsing).to be true
11
11
  expect(config.default_encoding).to eq("UTF-8")
12
12
  expect(config.default_indent).to eq(2)
13
+ expect(config.default_line_ending).to eq("\n")
13
14
  expect(config.entity_encoding).to eq(:basic)
14
15
  end
15
16
 
@@ -89,6 +90,38 @@ RSpec.describe Moxml::Config do
89
90
  end
90
91
  end
91
92
 
93
+ describe "#default_line_ending=" do
94
+ it "accepts LINE_ENDING_LF" do
95
+ config.default_line_ending = Moxml::Config::LINE_ENDING_LF
96
+ expect(config.default_line_ending).to eq("\n")
97
+ end
98
+
99
+ it "accepts LINE_ENDING_CRLF" do
100
+ config.default_line_ending = Moxml::Config::LINE_ENDING_CRLF
101
+ expect(config.default_line_ending).to eq("\r\n")
102
+ end
103
+
104
+ it "rejects nil" do
105
+ expect { config.default_line_ending = nil }
106
+ .to raise_error(ArgumentError, /Invalid line_ending/)
107
+ end
108
+
109
+ it "rejects arbitrary strings" do
110
+ expect { config.default_line_ending = "BAD" }
111
+ .to raise_error(ArgumentError, /Invalid line_ending/)
112
+ end
113
+
114
+ it "rejects bare CR" do
115
+ expect { config.default_line_ending = "\r" }
116
+ .to raise_error(ArgumentError, /Invalid line_ending/)
117
+ end
118
+
119
+ it "rejects empty string" do
120
+ expect { config.default_line_ending = "" }
121
+ .to raise_error(ArgumentError, /Invalid line_ending/)
122
+ end
123
+ end
124
+
92
125
  describe "#adapter=" do
93
126
  it "sets valid adapter" do
94
127
  config.adapter = :ox
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: moxml
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.22
4
+ version: 0.1.23
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-05-25 00:00:00.000000000 Z
11
+ date: 2026-06-01 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: |
14
14
  Moxml is a unified XML manipulation library that provides a common API
@@ -287,6 +287,7 @@ files:
287
287
  - spec/integration/shared_examples/high_level/context_behavior.rb
288
288
  - spec/integration/shared_examples/high_level/document_builder_behavior.rb
289
289
  - spec/integration/shared_examples/integration_workflows.rb
290
+ - spec/integration/shared_examples/line_ending_behavior.rb
290
291
  - spec/integration/shared_examples/node_wrappers/.gitkeep
291
292
  - spec/integration/shared_examples/node_wrappers/attribute_behavior.rb
292
293
  - spec/integration/shared_examples/node_wrappers/cdata_behavior.rb