feat!: add parameter property_name to Spec::extracting method#91
Open
haraldmaida wants to merge 1 commit into
Open
feat!: add parameter property_name to Spec::extracting method#91haraldmaida wants to merge 1 commit into
property_name to Spec::extracting method#91haraldmaida wants to merge 1 commit into
Conversation
BREAKING-CHANGE: In previous versions the `Spec::extracting` method set the property_name (field `expression` in `Spec`) to the default value `"subject"` and the user had to call the `Spec::named` method explicitly each time after calling the extracting method to get a usefull subject-name in the error report. Users that picked up `asserting` recently might not know yet about the possiblity of the `named` method. For expierience users of `asserting` it is very inconvient to always remember to call the `named` method after calling `extracting`. Therefore the `property_name` is now a mandatory parameter. It provides an additional advantage, as it concatenates the provided `property_name` to the original subject to form a kind of property path, like `"original_subject.extracted_property"`.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #91 +/- ##
==========================================
- Coverage 87.95% 87.73% -0.22%
==========================================
Files 42 42
Lines 6649 6696 +47
Branches 6649 6696 +47
==========================================
+ Hits 5848 5875 +27
- Misses 731 751 +20
Partials 70 70 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In previous versions the
Spec::extractingmethod set the property_name (fieldexpressioninSpec) to the default value"subject"and the user had to call theSpec::namedmethod explicitly each time after calling the extracting method to get a usefull subject-name in the error report. Users that picked upassertingrecently might not know yet about the possiblity of thenamedmethod. For expierience users ofassertingit is very inconvient to always remember to call thenamedmethod after callingextracting. Therefore theproperty_nameis now a mandatory parameter. It provides an additional advantage, as it concatenates the providedproperty_nameto the original subject to form a kind of property path, like"original_subject.extracted_property".BREAKING-CHANGE: the method
Spec::extractinghas a new additional parameterproperty_name.In exiting tests:
Spec::namedis called right after the callingextracted, take over the expression parameter from thenamedcall as the argument for theproperty_nameof theextractingcall. if the name references a field in a path like syntax, like "struct_name.field_name" just take over "field_name" as the value given asproperty_nameis appended to the original subject separated by a dot, like "original_subject.property_name".Spec::namedright after callingextracting, provide an suitable name for what is extracted.