diff --git a/spec/null_example_filter_spec.cr b/spec/null_example_filter_spec.cr new file mode 100644 index 0000000..42722a6 --- /dev/null +++ b/spec/null_example_filter_spec.cr @@ -0,0 +1,11 @@ +require "./spec_helper" + +describe Spectator::NullExampleFilter do + describe "#includes?" do + it "returns true" do + example = PassingExample.create + filter = Spectator::NullExampleFilter.new + filter.includes?(example).should be_true + end + end +end diff --git a/src/spectator/includes.cr b/src/spectator/includes.cr index c214b8f..19412a2 100644 --- a/src/spectator/includes.cr +++ b/src/spectator/includes.cr @@ -33,6 +33,7 @@ require "./example_filter" require "./source_example_filter" require "./line_example_filter" require "./name_example_filter" +require "./null_example_filter" require "./example_failed" require "./expectation_failed" diff --git a/src/spectator/null_example_filter.cr b/src/spectator/null_example_filter.cr new file mode 100644 index 0000000..b23e4ac --- /dev/null +++ b/src/spectator/null_example_filter.cr @@ -0,0 +1,9 @@ +module Spectator + # Filter that matches all examples. + class NullExampleFilter < ExampleFilter + # Checks whether the example satisfies the filter. + def includes?(example) + true + end + end +end