Skip to content

Commit

Permalink
Add a small quality-of-life change for tests
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
deriamis committed Feb 29, 2024
1 parent 5c0122b commit 9fa105e
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions spec/unit/library_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,15 @@ 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,
skitch,
ruby,
erchef,
chef,
])
].map(&:name))
end

context "with a complex dep tree" do
Expand All @@ -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
Expand All @@ -125,8 +125,7 @@ def generate_software(name, version, dependencies = [])
erchef, # project dep
chef, # project dep
chefdk, # project dep
]
)
].map(&:name))
end
end
end
Expand Down

0 comments on commit 9fa105e

Please sign in to comment.