Skip to content
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

feat: Add TestCase utility for configuring insta settings #277

Merged
merged 1 commit into from
Jul 22, 2024

Conversation

spencewenski
Copy link
Member

Add some utilities to set some common insta settings. The settings are configurable using the TestCaseConfig builder struct. The builder yields a TestCase struct containing the configured insta settings.

The settings available to configure currently are:

  1. Redact UUIDs from snapshots; UUIDs are replaced with the string [uuid]
  2. Set the suffix of the snapshot (which can be provided manually or automatically based on the thread name). This is useful when using insta along with rstest.
  3. Auto-bind to the current scope on creation of the TestCase struct to avoid the need to remember to bind the settings scope.

Add some utilities to set some common `insta` settings. The settings are
configurable using the `TestCaseConfig` builder struct. The builder
yields a `TestCase` struct containing the configured `insta` settings.

The settings available to configure currently are:

1. Redact UUIDs from snapshots; UUIDs are replaced with the string `[uuid]`
2. Set the suffix of the snapshot (which can be provided manually or
   automatically based on the thread name). This is useful when using
   `insta` along with `rstest`.
3. Auto-bind to the current scope on creation of the `TestCase` struct
   to avoid the need to remember to bind the settings scope.
Copy link

codecov bot commented Jul 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 44.99%. Comparing base (23be615) to head (31abc0a).

Files Coverage Δ
src/api/cli/mod.rs 77.22% <ø> (ø)
src/config/app_config.rs 40.35% <ø> (ø)
src/config/auth/mod.rs 100.00% <ø> (ø)
src/config/database/mod.rs 89.28% <ø> (ø)
src/config/health_check/mod.rs 100.00% <ø> (ø)
src/config/service/http/default_routes.rs 100.00% <ø> (ø)
src/config/service/http/initializer.rs 100.00% <ø> (ø)
src/config/service/http/middleware.rs 100.00% <ø> (ø)
src/config/service/mod.rs 100.00% <ø> (ø)
src/config/service/worker/sidekiq/mod.rs 83.33% <ø> (ø)
... and 10 more

... and 12 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 23be615...31abc0a. Read the comment docs.

@spencewenski spencewenski merged commit bc52376 into main Jul 22, 2024
15 checks passed
@spencewenski spencewenski deleted the testing-mod branch July 22, 2024 05:03
@github-actions github-actions bot mentioned this pull request Jul 22, 2024
spencewenski pushed a commit that referenced this pull request Jul 22, 2024
## 🤖 New release
* `roadster`: 0.5.5 -> 0.5.6

<details><summary><i><b>Changelog</b></i></summary><p>

<blockquote>

##
[0.5.6](roadster-v0.5.5...roadster-v0.5.6)
- 2024-07-22

### Added
- Add `TestCase` utility for configuring `insta` settings
([#277](#277))
</blockquote>


</p></details>

---
This PR was generated with
[release-plz](https://github.com/MarcoIeni/release-plz/).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@spencewenski spencewenski mentioned this pull request Jul 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant