diff --git a/CHANGELOG.md b/CHANGELOG.md index 2035a59..9b6c053 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. diff --git a/src/spectator/dsl/examples.cr b/src/spectator/dsl/examples.cr index 38c62f0..03484ae 100644 --- a/src/spectator/dsl/examples.cr +++ b/src/spectator/dsl/examples.cr @@ -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 diff --git a/src/spectator/dsl/groups.cr b/src/spectator/dsl/groups.cr index 002860c..8f47b27 100644 --- a/src/spectator/dsl/groups.cr +++ b/src/spectator/dsl/groups.cr @@ -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