-
Notifications
You must be signed in to change notification settings - Fork 105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Misleading diagnostic from unit tests when an attribute expected to be an array is missing #940
Comments
This issue has been marked stale because it is open with no recent activity. The PDK Team is actively prioritizing existing bugs and new features, if this issue is still important to you please comment and we will add this to our backlog to complete. |
Pursuant to the no-issue-activity label: I would rate this a low-priority issue, but I do account it a bug, and the fact that there has been no activity on it does not mean that it should not be fixed. |
This issue has been marked stale because it is open with no recent activity. The PDK Team is actively prioritizing existing bugs and new features, if this issue is still important to you please comment and we will add this to our backlog to complete. |
Again, I acknowledge that this is probably a low-priority issue, but it still should be fixed. |
This issue has been marked stale because it is open with no recent activity. The PDK Team is actively prioritizing existing bugs and new features, if this issue is still important to you please comment and we will add this to our backlog to complete. |
I would still like this issue to be fixed. |
@jcbollinger I'm not sure if this is the right place to raise this error, this seems to be an issue with the rspec, not PDK itself? |
Describe the bug
When a spec test asserts that a class or resource is declared with an attribute having an array value, but instead that class or resource is declared without specifying any value for that attribute, the resulting diagnostic from
pdk test unit
is misleading. For example:Specifically, the diagnostic says that the attribute is set to '[nil]', which appears to correspond to an array with an element having an undef value, as opposed to no value at all or
undef
.In contrast, if the test instead asserts that the attribute has a scalar value then the resulting diagnostic reports that "it is set to nil". To the extent that the attribute can be considered to have any value when none has been declared, surely that value does not depend on the one that was asserted.
To Reproduce
The overall module structure was generated with
pdk new module example
.Any class will do. The diagnostic quoted above was generated with this one:
The above diagnostic was generated with this spec test:
The diagnostic generated does not seem to depend on whether the class or resource in question actually has an attribute of the specified name. All that matters is that
undef
; andExpected behavior
If a test asserts a value for a class or resource attribute, but no value is in fact expressly declared, then the diagnostic output should say "but it is set to nil", regardless of the data type of the asserted value.
Additional context
The text was updated successfully, but these errors were encountered: