Tests: Fix overly-specific YAML test
We don't care exactly how the YAML is serialized, as long as it parses into the same thing. On my machine, for example, ruby 2.7 writes a nil in YAML with trailing whitespace, and ruby 3.0 does not. But, trailing whitespace doesn't matter in this case. It still deserializes into a nil.
This commit is contained in:
parent
9f328e47a9
commit
6a030eac7a
|
@ -24,12 +24,14 @@ module PaperTrail
|
|||
it "creates a version with custom changes" do
|
||||
adapter = instance_spy("CustomObjectChangesAdapter")
|
||||
PaperTrail.config.object_changes_adapter = adapter
|
||||
custom_changes_value = [["name", nil, "Dashboard"]]
|
||||
allow(adapter).to(
|
||||
receive(:diff).with(
|
||||
hash_including("name" => [nil, "Dashboard"])
|
||||
).and_return([["name", nil, "Dashboard"]])
|
||||
).and_return(custom_changes_value)
|
||||
)
|
||||
expect(widget.versions.last.object_changes).to eq("---\n- - name\n - \n - Dashboard\n")
|
||||
yaml = widget.versions.last.object_changes
|
||||
expect(YAML.load(yaml)).to eq(custom_changes_value)
|
||||
expect(adapter).to have_received(:diff)
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue