Add f-prefix variants of groups and examples

For instance: `fit` for `it "...", :focus`
This commit is contained in:
Michael Miller 2021-08-18 13:55:21 -06:00
parent 2b27ea5a01
commit 21d14bd814
No known key found for this signature in database
GPG key ID: F9A0C5C65B162436
3 changed files with 22 additions and 0 deletions

View file

@ -29,6 +29,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Allow named arguments and assignments for `provided` (`given`) block.
- Add `aggregate_failures` to capture and report multiple failed expectations. [#24](https://gitlab.com/arctic-fox/spectator/-/issues/24)
- Supports matching groups. [#25](https://gitlab.com/arctic-fox/spectator/-/issues/25) [#24](https://github.com/icy-arctic-fox/spectator/issues/24)
- Add `filter_run_including`, `filter_run_excluding`, and `filter_run_when_matching` to config block.
- By default, only run tests when any are marked with `focus: true`.
- Add "f-prefix" blocks for examples and groups (`fit`, `fdescribe`, etc.) as a short-hand for specifying `focus: true`.
### Changed
- `given` (now `provided`) blocks changed to produce a single example. `it` can no longer be nested in a `provided` block.

View file

@ -137,6 +137,12 @@ module Spectator::DSL
define_example :specify
define_example :fexample, focus: true
define_example :fit, focus: true
define_example :fspecify, focus: true
@[Deprecated("Behavior of pending blocks will change in Spectator v0.11.0. Use `skip` instead.")]
define_pending_example :pending

View file

@ -181,6 +181,12 @@ module Spectator::DSL
define_example_group :xcontext, skip: "Temporarily skipped with xcontext"
define_example_group :fexample_group, focus: true
define_example_group :fdescribe, focus: true
define_example_group :fcontext, focus: true
# Defines a new iterative example group.
# This type of group duplicates its contents for each element in *collection*.
#
@ -197,6 +203,8 @@ module Spectator::DSL
# :ditto:
define_iterative_group :xsample, skip: "Temporarily skipped with xsample"
define_iterative_group :fsample, focus: true
# Defines a new iterative example group.
# This type of group duplicates its contents for each element in *collection*.
# This is the same as `#sample` except that the items are shuffled.
@ -218,5 +226,10 @@ module Spectator::DSL
define_iterative_group :xrandom_sample, skip: "Temporarily skipped with xrandom_sample" do |collection|
collection.to_a.shuffle(::Spectator.random)
end
# :ditto:
define_iterative_group :frandom_sample, focus: true do |collection|
collection.to_a.shuffle(::Spectator.random)
end
end
end