From 9fa105eb963d95f1a2c9a325c446562aae9ec97c Mon Sep 17 00:00:00 2001 From: Ryan Egesdahl Date: Wed, 28 Feb 2024 16:01:57 -0800 Subject: [PATCH] Add a small quality-of-life change for tests In the Project and Library specs, we use an `expect` construct to ensure the build order is consistent. However, when there is a failure, we see a diff of the internal object representations. We can map the `:name` property into the construct instead to get a diff of the component names. Signed-off-by: Ryan Egesdahl --- spec/unit/library_spec.rb | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/spec/unit/library_spec.rb b/spec/unit/library_spec.rb index 8b5df6540..33bb292ed 100644 --- a/spec/unit/library_spec.rb +++ b/spec/unit/library_spec.rb @@ -82,7 +82,7 @@ def generate_software(name, version, dependencies = []) end it "returns an array of software descriptions, with all top level deps first" do - expect(library.build_order).to eq([ + expect(library.build_order.map(&:name)).to eq([ preparation, erlang, postgresql, @@ -90,7 +90,7 @@ def generate_software(name, version, dependencies = []) ruby, erchef, chef, - ]) + ].map(&:name)) end context "with a complex dep tree" do @@ -113,7 +113,7 @@ def generate_software(name, version, dependencies = []) end it "returns an array of software descriptions, with all top level deps first, assuming they are not themselves transitive deps" do - expect(library.build_order).to eql( + expect(library.build_order(&:name)).to eql( [ preparation, # first erlang, # via erchef project @@ -125,8 +125,7 @@ def generate_software(name, version, dependencies = []) erchef, # project dep chef, # project dep chefdk, # project dep - ] - ) + ].map(&:name)) end end end