Skip to content

feat!: add parameter property_name to Spec::extracting method#91

Open
haraldmaida wants to merge 1 commit into
mainfrom
feat/add-propertyname-param-to-extracting-method
Open

feat!: add parameter property_name to Spec::extracting method#91
haraldmaida wants to merge 1 commit into
mainfrom
feat/add-propertyname-param-to-extracting-method

Conversation

@haraldmaida

Copy link
Copy Markdown
Member

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".

BREAKING-CHANGE: the method Spec::extracting has a new additional parameter property_name.
In exiting tests:

  • In case the method Spec::named is called right after the calling extracted, take over the expression parameter from the named call as the argument for the property_name of the extracting call. 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 as property_name is appended to the original subject separated by a dot, like "original_subject.property_name".
  • In case the method is used without calling the method Spec::named right after calling extracting, provide an suitable name for what is extracted.

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"`.
@haraldmaida haraldmaida self-assigned this Jun 19, 2026
@haraldmaida haraldmaida added the enhancement New feature or request label Jun 19, 2026
@codecov

codecov Bot commented Jun 19, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 64.93506% with 27 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.73%. Comparing base (b93b6fd) to head (e83dec5).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
src/derived_spec/mod.rs 46.00% 27 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant