Skip to content

Commit 9fa105e

Browse files
committed
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 <[email protected]>
1 parent 5c0122b commit 9fa105e

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

spec/unit/library_spec.rb

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,15 +82,15 @@ def generate_software(name, version, dependencies = [])
8282
end
8383

8484
it "returns an array of software descriptions, with all top level deps first" do
85-
expect(library.build_order).to eq([
85+
expect(library.build_order.map(&:name)).to eq([
8686
preparation,
8787
erlang,
8888
postgresql,
8989
skitch,
9090
ruby,
9191
erchef,
9292
chef,
93-
])
93+
].map(&:name))
9494
end
9595

9696
context "with a complex dep tree" do
@@ -113,7 +113,7 @@ def generate_software(name, version, dependencies = [])
113113
end
114114

115115
it "returns an array of software descriptions, with all top level deps first, assuming they are not themselves transitive deps" do
116-
expect(library.build_order).to eql(
116+
expect(library.build_order(&:name)).to eql(
117117
[
118118
preparation, # first
119119
erlang, # via erchef project
@@ -125,8 +125,7 @@ def generate_software(name, version, dependencies = [])
125125
erchef, # project dep
126126
chef, # project dep
127127
chefdk, # project dep
128-
]
129-
)
128+
].map(&:name))
130129
end
131130
end
132131
end

0 commit comments

Comments
 (0)