Skip to content

Commit 3d58d06

Browse files
committed
Compare parsed YAML files not text of YAML files
1 parent 0dba8fe commit 3d58d06

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

spec/octofacts_updater/fixture_spec.rb

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,15 @@
177177
obj.write_file(outfile)
178178

179179
expect(File.file?(outfile)).to eq(true)
180-
expect(File.read(outfile)).to eq(File.read(fixture_file))
180+
181+
# Different ruby versions or environments can cause the YAML generation to be slightly different.
182+
# For example we ran into this diff:
183+
# - uuid: 09809809-0980-0980-0980-098098098098
184+
# + uuid: '09809809-0980-0980-0980-098098098098'
185+
# To avoid this parse the YAML and compare that instead.
186+
fixture_yaml = YAML.safe_load(File.read(fixture_file))
187+
generated_yaml = YAML.safe_load(File.read(outfile))
188+
expect(generated_yaml).to eq(fixture_yaml)
181189
end
182190
end
183191
end

0 commit comments

Comments
 (0)