Improve service return type test
The following discussion from !4090 (merged) should be addressed:
-
@kkloss started a discussion: (+4 comments) WDYT about using a
context
for each in theGDK::Services.all
still?GDK::Services.all.each do |service| context service.class.name do it 'has expected return types', :aggregate_failures do
If I change the Vite command back to an array, we get this error
1) GDK::Services.all every service has expected return types Failure/Error: expect(service.command).to be_kind_of(String) expected ["support/exec-cd", "gitlab", "bundle", "exec", "vite", "dev"] to be a kind of String # ./spec/lib/gdk/services_spec.rb:39:in `block (5 levels) in <top (required)>' # ./spec/lib/gdk/services_spec.rb:37:in `each' # ./spec/lib/gdk/services_spec.rb:37:in `block (4 levels) in <top (required)>'
However, that doesn’t tell me in which service the error occurred. Here we can tell from the command but what > if it is
nil
(->expected nil to be a kind of String
)?With the suggestion, the error would be more precise:
1) GDK::Services.all GDK::Services::Vite has expected return types Failure/Error: expect(service.command).to be_kind_of(String) expected ["support/exec-cd", "gitlab", "bundle", "exec", "vite", "dev"] to be a kind of String # ./spec/lib/gdk/services_spec.rb:43:in `block (5 levels) in <top (required)>'
Note that we’d have to stub the
gdk.yml
:before do stub_gdk_yaml({}) end