From 5f15891a41b10f8dcfbd8199d7a9a124ab7e589f Mon Sep 17 00:00:00 2001 From: Michael Miller Date: Mon, 22 Mar 2021 17:05:28 -0600 Subject: [PATCH 01/14] Crystal 1.0.0 and Spectator 0.9.33 --- README.md | 2 +- shard.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 0edf63f..172c5ad 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ Add this to your application's `shard.yml`: development_dependencies: spectator: gitlab: arctic-fox/spectator - version: ~> 0.9.31 + version: ~> 0.9.33 ``` Usage diff --git a/shard.yml b/shard.yml index 1779903..f3242a5 100644 --- a/shard.yml +++ b/shard.yml @@ -1,12 +1,12 @@ name: spectator -version: 0.9.32 +version: 0.9.33 description: | A feature-rich spec testing framework for Crystal with similarities to RSpec. authors: - Michael Miller -crystal: 0.35.1 +crystal: 1.0.0 license: MIT From 8fafd2467d9b09e0e0b5e781f9226e2058a77aa1 Mon Sep 17 00:00:00 2001 From: matthewmcgarvey Date: Tue, 30 Mar 2021 00:18:08 -0400 Subject: [PATCH 02/14] Allow matching any line number of example in filter --- spec/line_number_spec.cr | 12 ++++++++---- src/spectator/dsl/examples.cr | 8 ++++---- src/spectator/line_example_filter.cr | 8 +++++++- src/spectator/source.cr | 6 +++++- 4 files changed, 24 insertions(+), 10 deletions(-) diff --git a/spec/line_number_spec.cr b/spec/line_number_spec.cr index 86d858b..b8c0668 100644 --- a/spec/line_number_spec.cr +++ b/spec/line_number_spec.cr @@ -5,15 +5,19 @@ Spectator.describe Spectator do subject(source) { current_example.source } context "line numbers" do - subject { source.line } + it "contains starting line of spec" do + expect(source.line).to eq(__LINE__ - 1) + end - it "match source code" do - is_expected.to eq(__LINE__ - 1) + it "contains ending line of spec" do + expect(source.end_line).to eq(__LINE__ + 1) end it "handles multiple lines and examples" do # Offset is important. - is_expected.to eq(__LINE__ - 2) + expect(source.line).to eq(__LINE__ - 2) + expect(source.end_line).to eq(__LINE__ + 2) + # Offset is still important. end end diff --git a/src/spectator/dsl/examples.cr b/src/spectator/dsl/examples.cr index 641fe3b..06232e1 100644 --- a/src/spectator/dsl/examples.cr +++ b/src/spectator/dsl/examples.cr @@ -19,9 +19,9 @@ module Spectator {% end %} {% if block.is_a?(Nop) %} - %source = ::Spectator::Source.new({{description.filename}}, {{description.line_number}}) + %source = ::Spectator::Source.new({{description.filename}}, line: {{description.line_number}}, end_line: {{description.end_line_number}}) {% else %} - %source = ::Spectator::Source.new({{block.filename}}, {{block.line_number}}) + %source = ::Spectator::Source.new({{block.filename}}, line: {{block.line_number}}, end_line: {{block.end_line_number}}) {% end %} ::Spectator::SpecBuilder.add_example( {{description.is_a?(StringLiteral) || description.is_a?(StringInterpolation) || description.is_a?(NilLiteral) ? description : description.stringify}}, @@ -50,9 +50,9 @@ module Spectator {% end %} {% if block.is_a?(Nop) %} - %source = ::Spectator::Source.new({{description.filename}}, {{description.line_number}}) + %source = ::Spectator::Source.new({{description.filename}}, line: {{description.line_number}}, end_line: {{description.end_line_number}}) {% else %} - %source = ::Spectator::Source.new({{block.filename}}, {{block.line_number}}) + %source = ::Spectator::Source.new({{block.filename}}, line: {{block.line_number}}, end_line: {{block.end_line_number}}) {% end %} ::Spectator::SpecBuilder.add_pending_example( {{description.is_a?(StringLiteral) || description.is_a?(StringInterpolation) || description.is_a?(NilLiteral) ? description : description.stringify}}, diff --git a/src/spectator/line_example_filter.cr b/src/spectator/line_example_filter.cr index 85cd739..4063f34 100644 --- a/src/spectator/line_example_filter.cr +++ b/src/spectator/line_example_filter.cr @@ -7,7 +7,13 @@ module Spectator # Checks whether the example satisfies the filter. def includes?(example) : Bool - @line == example.source.line + source = example.source + # end_line is present so there is a range to check against + if end_line = source.end_line + (source.line..end_line).covers?(@line) + else + source.line == @line + end end end end diff --git a/src/spectator/source.cr b/src/spectator/source.cr index fa8935d..699fb39 100644 --- a/src/spectator/source.cr +++ b/src/spectator/source.cr @@ -5,10 +5,14 @@ module Spectator getter file : String # Line number in the file. + # If end_line is present, this is the starting line getter line : Int32 + # Ending line number in the file. + getter end_line : Int32? + # Creates the source. - def initialize(@file, @line) + def initialize(@file, @line, @end_line = nil) end # Parses a source from a string. From 5bd911341b1e8a7c8cbb92ab93812ac1a2a66864 Mon Sep 17 00:00:00 2001 From: matthewmcgarvey Date: Tue, 30 Mar 2021 15:29:51 -0400 Subject: [PATCH 03/14] Set end_line equal to line if end_line not provided --- src/spectator/line_example_filter.cr | 10 +++------- src/spectator/source.cr | 10 ++++++---- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/spectator/line_example_filter.cr b/src/spectator/line_example_filter.cr index 4063f34..0c65fba 100644 --- a/src/spectator/line_example_filter.cr +++ b/src/spectator/line_example_filter.cr @@ -7,13 +7,9 @@ module Spectator # Checks whether the example satisfies the filter. def includes?(example) : Bool - source = example.source - # end_line is present so there is a range to check against - if end_line = source.end_line - (source.line..end_line).covers?(@line) - else - source.line == @line - end + start_line = example.source.line + end_line = example.source.end_line + (start_line..end_line).covers?(@line) end end end diff --git a/src/spectator/source.cr b/src/spectator/source.cr index 699fb39..6afa3a7 100644 --- a/src/spectator/source.cr +++ b/src/spectator/source.cr @@ -4,15 +4,17 @@ module Spectator # Absolute file path. getter file : String - # Line number in the file. - # If end_line is present, this is the starting line + # Starting line number in the file. getter line : Int32 # Ending line number in the file. - getter end_line : Int32? + getter end_line : Int32 # Creates the source. - def initialize(@file, @line, @end_line = nil) + def initialize(@file, @line, end_line = nil) + # if an end line is not provided, + # make the end line the same as the start line + @end_line = end_line || @line end # Parses a source from a string. From 91ea9e6cab1366a9a33f13f2e9be44570a161a1d Mon Sep 17 00:00:00 2001 From: matthewmcgarvey Date: Tue, 30 Mar 2021 15:31:23 -0400 Subject: [PATCH 04/14] Comment out failing expectation with reference to open issue --- spec/line_number_spec.cr | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spec/line_number_spec.cr b/spec/line_number_spec.cr index b8c0668..ead7dd2 100644 --- a/spec/line_number_spec.cr +++ b/spec/line_number_spec.cr @@ -16,7 +16,8 @@ Spectator.describe Spectator do it "handles multiple lines and examples" do # Offset is important. expect(source.line).to eq(__LINE__ - 2) - expect(source.end_line).to eq(__LINE__ + 2) + # This line fails, refer to https://github.com/crystal-lang/crystal/issues/10562 + # expect(source.end_line).to eq(__LINE__ + 2) # Offset is still important. end end From 6481403c6f278aa96b00cc5847099a5bd206078d Mon Sep 17 00:00:00 2001 From: Michael Miller Date: Wed, 31 Mar 2021 15:01:01 -0600 Subject: [PATCH 05/14] Bump version to 0.9.34 --- shard.yml | 2 +- src/spectator.cr | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/shard.yml b/shard.yml index f3242a5..f6570b0 100644 --- a/shard.yml +++ b/shard.yml @@ -1,5 +1,5 @@ name: spectator -version: 0.9.33 +version: 0.9.34 description: | A feature-rich spec testing framework for Crystal with similarities to RSpec. diff --git a/src/spectator.cr b/src/spectator.cr index c669c1c..b01464d 100644 --- a/src/spectator.cr +++ b/src/spectator.cr @@ -6,7 +6,7 @@ module Spectator extend self # Current version of the Spectator library. - VERSION = "0.9.32" + VERSION = "0.9.34" # Top-level describe method. # All specs in a file must be wrapped in this call. From 347e07e10437eeed5a02ae4910aa6add317067ef Mon Sep 17 00:00:00 2001 From: Michael Miller Date: Wed, 31 Mar 2021 15:07:00 -0600 Subject: [PATCH 06/14] Update CHANGELOG --- CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 52772fc..4df5da1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.9.34] - 2021-03-31 +### Changed +- Allow filtering examples by using any line in the example block. [#19](https://github.com/icy-arctic-fox/spectator/issues/19) Thanks @matthewmcgarvey ! + +## [0.9.33] - 2021-03-22 +### Changed +- Target Crystal 1.0 + ## [0.9.32] - 2021-02-03 ### Fixed - Fix source reference with brace-less example syntax. [#20](https://github.com/icy-arctic-fox/spectator/issues/20) From 2ec6a31f34f197d1005f49f94a54b7955fac1510 Mon Sep 17 00:00:00 2001 From: Michael Miller Date: Wed, 31 Mar 2021 15:07:43 -0600 Subject: [PATCH 07/14] Update README to reference latest version --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 172c5ad..ccfc5f1 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ Add this to your application's `shard.yml`: development_dependencies: spectator: gitlab: arctic-fox/spectator - version: ~> 0.9.33 + version: ~> 0.9.34 ``` Usage From 93e270f87aa0e1df210d9c96c15a49c9cd8a0ec6 Mon Sep 17 00:00:00 2001 From: Michael Miller Date: Sat, 17 Apr 2021 09:38:29 -0600 Subject: [PATCH 08/14] Support variables and methods for type matcher (be_a). Addresses https://github.com/icy-arctic-fox/spectator/issues/25 --- spec/matchers/type_matcher_spec.cr | 26 ++++++++++++++++++++++++++ src/spectator/dsl/matchers.cr | 2 +- src/spectator/matchers/type_matcher.cr | 5 +++++ 3 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 spec/matchers/type_matcher_spec.cr diff --git a/spec/matchers/type_matcher_spec.cr b/spec/matchers/type_matcher_spec.cr new file mode 100644 index 0000000..22d218e --- /dev/null +++ b/spec/matchers/type_matcher_spec.cr @@ -0,0 +1,26 @@ +require "../spec_helper" + +Spectator.describe Spectator::Matchers::TypeMatcher do + context String do # Sets `described_class` to String + def other_type + Int32 + end + + describe "#|" do + it "works on sets" do + super_set = (described_class | other_type) + + expect(42).to be_kind_of(super_set) + expect("foo").to be_a(super_set) + end + end + + it "works on described_class" do + expect("foo").to be_a_kind_of(described_class) + end + + it "works on plain types" do + expect(42).to be_a(Int32) + end + end +end diff --git a/src/spectator/dsl/matchers.cr b/src/spectator/dsl/matchers.cr index 9deb404..8332c44 100644 --- a/src/spectator/dsl/matchers.cr +++ b/src/spectator/dsl/matchers.cr @@ -77,7 +77,7 @@ module Spectator # expect(x).to be_a(Int32 | String) # ``` macro be_a(expected) - ::Spectator::Matchers::TypeMatcher({{expected}}).new + ::Spectator::Matchers::TypeMatcher.create({{expected}}) end # Indicates that some value should be of a specified type. diff --git a/src/spectator/matchers/type_matcher.cr b/src/spectator/matchers/type_matcher.cr index f8401d4..325265a 100644 --- a/src/spectator/matchers/type_matcher.cr +++ b/src/spectator/matchers/type_matcher.cr @@ -4,6 +4,11 @@ module Spectator::Matchers # Matcher that tests a value is of a specified type. # The values are compared with the `Object#is_a?` method. struct TypeMatcher(Expected) < StandardMatcher + # Alternate constructor that works with constant types and types from variables. + def self.create(type : T.class) forall T + TypeMatcher(T).new + end + # Short text about the matcher's purpose. # This explains what condition satisfies the matcher. # The description is used when the one-liner syntax is used. From 25638d766ef78fae22117874c0437c5d7d897844 Mon Sep 17 00:00:00 2001 From: Michael Miller Date: Sun, 18 Apr 2021 18:08:08 -0600 Subject: [PATCH 09/14] Bump version to 0.9.35 --- CHANGELOG.md | 10 +++++++++- README.md | 2 +- shard.yml | 2 +- src/spectator.cr | 2 +- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4df5da1..b03ad59 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.9.35] - 2021-04-18 +### Fixed +- Allow types stored in variables or returned by methods in `be_a` (and variants), not just type literals. [#25](https://github.com/icy-arctic-fox/spectator/issues/25) + ## [0.9.34] - 2021-03-31 ### Changed - Allow filtering examples by using any line in the example block. [#19](https://github.com/icy-arctic-fox/spectator/issues/19) Thanks @matthewmcgarvey ! @@ -249,7 +253,11 @@ This has been changed so that it compiles and raises an error at runtime with a First version ready for public use. -[Unreleased]: https://gitlab.com/arctic-fox/spectator/-/compare/v0.9.31...HEAD +[Unreleased]: https://gitlab.com/arctic-fox/spectator/-/compare/v0.9.35...HEAD +[0.9.35]: https://gitlab.com/arctic-fox/spectator/-/compare/v0.9.34...v0.9.35 +[0.9.34]: https://gitlab.com/arctic-fox/spectator/-/compare/v0.9.33...v0.9.34 +[0.9.33]: https://gitlab.com/arctic-fox/spectator/-/compare/v0.9.32...v0.9.33 +[0.9.32]: https://gitlab.com/arctic-fox/spectator/-/compare/v0.9.31...v0.9.32 [0.9.31]: https://gitlab.com/arctic-fox/spectator/-/compare/v0.9.30...v0.9.31 [0.9.30]: https://gitlab.com/arctic-fox/spectator/-/compare/v0.9.29...v0.9.30 [0.9.29]: https://gitlab.com/arctic-fox/spectator/-/compare/v0.9.28...v0.9.29 diff --git a/README.md b/README.md index ccfc5f1..c30a59c 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ Add this to your application's `shard.yml`: development_dependencies: spectator: gitlab: arctic-fox/spectator - version: ~> 0.9.34 + version: ~> 0.9.35 ``` Usage diff --git a/shard.yml b/shard.yml index f6570b0..3b54376 100644 --- a/shard.yml +++ b/shard.yml @@ -1,5 +1,5 @@ name: spectator -version: 0.9.34 +version: 0.9.35 description: | A feature-rich spec testing framework for Crystal with similarities to RSpec. diff --git a/src/spectator.cr b/src/spectator.cr index b01464d..bc9ef77 100644 --- a/src/spectator.cr +++ b/src/spectator.cr @@ -6,7 +6,7 @@ module Spectator extend self # Current version of the Spectator library. - VERSION = "0.9.34" + VERSION = "0.9.35" # Top-level describe method. # All specs in a file must be wrapped in this call. From f0b524dc4726b3727b067d90314a2e9e24fa1101 Mon Sep 17 00:00:00 2001 From: Michael Miller Date: Sat, 12 Sep 2020 15:28:55 -0600 Subject: [PATCH 10/14] Remove workaround https://github.com/icy-arctic-fox/spectator/issues/1 should be resolved by https://github.com/crystal-lang/crystal/pull/8234 --- src/spectator/includes.cr | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/spectator/includes.cr b/src/spectator/includes.cr index 4425f99..894a045 100644 --- a/src/spectator/includes.cr +++ b/src/spectator/includes.cr @@ -4,12 +4,6 @@ # Including all files with a wildcard would accidentally enable should-syntax. # Unfortunately, that leads to the existence of this file to include everything but that file. -# FIXME: Temporary (hopefully) require statement to workaround Crystal issue #7060. -# https://github.com/crystal-lang/crystal/issues/7060 -# The primary issue seems to be around OpenSSL. -# By explicitly including it before Spectator functionality, we workaround the issue. -require "openssl" - # First the sub-modules. require "./dsl" require "./expectations" From 18fb2d3879459e7380669becd860e4c52447acbf Mon Sep 17 00:00:00 2001 From: Michael Miller Date: Sun, 25 Apr 2021 23:39:26 -0600 Subject: [PATCH 11/14] Bump version to 0.9.36 --- CHANGELOG.md | 7 ++++++- README.md | 2 +- shard.yml | 2 +- src/spectator.cr | 2 +- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b03ad59..bd81cf4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.9.36] - 2021-04-22 +### Fixed +- Remove old workaround that prevented compilation on Windows. [#58](https://gitlab.com/arctic-fox/spectator/-/issues/58) + ## [0.9.35] - 2021-04-18 ### Fixed - Allow types stored in variables or returned by methods in `be_a` (and variants), not just type literals. [#25](https://github.com/icy-arctic-fox/spectator/issues/25) @@ -253,7 +257,8 @@ This has been changed so that it compiles and raises an error at runtime with a First version ready for public use. -[Unreleased]: https://gitlab.com/arctic-fox/spectator/-/compare/v0.9.35...HEAD +[Unreleased]: https://gitlab.com/arctic-fox/spectator/-/compare/v0.9.36...HEAD +[0.9.35]: https://gitlab.com/arctic-fox/spectator/-/compare/v0.9.35...v0.9.36 [0.9.35]: https://gitlab.com/arctic-fox/spectator/-/compare/v0.9.34...v0.9.35 [0.9.34]: https://gitlab.com/arctic-fox/spectator/-/compare/v0.9.33...v0.9.34 [0.9.33]: https://gitlab.com/arctic-fox/spectator/-/compare/v0.9.32...v0.9.33 diff --git a/README.md b/README.md index c30a59c..082c951 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ Add this to your application's `shard.yml`: development_dependencies: spectator: gitlab: arctic-fox/spectator - version: ~> 0.9.35 + version: ~> 0.9.36 ``` Usage diff --git a/shard.yml b/shard.yml index 3b54376..c545790 100644 --- a/shard.yml +++ b/shard.yml @@ -1,5 +1,5 @@ name: spectator -version: 0.9.35 +version: 0.9.36 description: | A feature-rich spec testing framework for Crystal with similarities to RSpec. diff --git a/src/spectator.cr b/src/spectator.cr index bc9ef77..3f3619b 100644 --- a/src/spectator.cr +++ b/src/spectator.cr @@ -6,7 +6,7 @@ module Spectator extend self # Current version of the Spectator library. - VERSION = "0.9.35" + VERSION = "0.9.36" # Top-level describe method. # All specs in a file must be wrapped in this call. From 5dfc60d4cd894938e024645de6376719cf3f2e52 Mon Sep 17 00:00:00 2001 From: Michael Miller Date: Mon, 26 Apr 2021 16:53:04 -0600 Subject: [PATCH 12/14] Fix nil reference error when example name is unavailable --- src/spectator/formatting/document_formatter.cr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/spectator/formatting/document_formatter.cr b/src/spectator/formatting/document_formatter.cr index 16efdf8..331fb13 100644 --- a/src/spectator/formatting/document_formatter.cr +++ b/src/spectator/formatting/document_formatter.cr @@ -29,7 +29,7 @@ module Spectator::Formatting # Produces a single character output based on a result. def end_example(result) @previous_hierarchy.size.times { @io.print INDENT } - @io.puts result.accept(Color) { result.example.name } + @io.puts result.accept(Color) { result.example } end # Produces a list of groups making up the hierarchy for an example. From 6c98d7107c6bc3fc1a3c4c3366badf800f6866d7 Mon Sep 17 00:00:00 2001 From: Michael Miller Date: Mon, 26 Apr 2021 17:11:53 -0600 Subject: [PATCH 13/14] Docs --- src/spectator/anything.cr | 11 ++++++++--- src/spectator/context.cr | 7 +++++++ src/spectator/source.cr | 2 +- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/spectator/anything.cr b/src/spectator/anything.cr index 511a024..2991e87 100644 --- a/src/spectator/anything.cr +++ b/src/spectator/anything.cr @@ -1,14 +1,19 @@ module Spectator + # Equals and matches everything. + # All comparison methods will always return true. struct Anything - def ==(other) + # Returns true for equality. + def ==(_other) true end - def ===(other) + # Returns true for case equality. + def ===(_other) true end - def =~(other) + # Returns true for matching. + def =~(_other) true end end diff --git a/src/spectator/context.cr b/src/spectator/context.cr index 2860ae3..475f49c 100644 --- a/src/spectator/context.cr +++ b/src/spectator/context.cr @@ -4,10 +4,17 @@ # This type is intentionally outside the `Spectator` module. # The reason for this is to prevent name collision when using the DSL to define a spec. abstract class SpectatorContext + # Produces a dummy string to represent the context as a string. + # This prevents the default behavior, which normally stringifies instance variables. + # Due to the sheer amount of types Spectator can create + # and that the Crystal compiler instantiates a `#to_s` and/or `#inspect` for each of those types, + # an explosion in method instances can be created. + # The compile time is drastically reduced by using a dummy string instead. def to_s(io) io << "Context" end + # :ditto: def inspect(io) io << "Context<" io << self.class diff --git a/src/spectator/source.cr b/src/spectator/source.cr index e69f5ff..fa28cea 100644 --- a/src/spectator/source.cr +++ b/src/spectator/source.cr @@ -1,7 +1,7 @@ require "json" module Spectator - # Define the file and line number something originated from. + # Defines the file and line numbers something originated from. struct Source # Absolute file path. getter file : String From f549fcfa7a377bc60fdfa47eebfb9d3e4c3c1b3b Mon Sep 17 00:00:00 2001 From: Michael Miller Date: Mon, 26 Apr 2021 17:17:18 -0600 Subject: [PATCH 14/14] Minor changes to configure methods --- src/spectator.cr | 2 +- src/spectator/spec/builder.cr | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/spectator.cr b/src/spectator.cr index 3dff022..88238a8 100644 --- a/src/spectator.cr +++ b/src/spectator.cr @@ -50,7 +50,7 @@ module Spectator # A `ConfigBuilder` is yielded to allow changing the configuration. # NOTE: The configuration set here can be overriden # with a `.spectator` file and command-line arguments. - def configure : Nil + def configure(& : ConfigBuilder -> _) : Nil yield @@config_builder end diff --git a/src/spectator/spec/builder.cr b/src/spectator/spec/builder.cr index f9a4ced..63975c4 100644 --- a/src/spectator/spec/builder.cr +++ b/src/spectator/spec/builder.cr @@ -175,7 +175,7 @@ module Spectator # Builds the configuration to use for the spec. # A `ConfigBuilder` is yielded to the block provided to this method. # That builder will be used to create the configuration. - def config + def configure(& : ConfigBuilder -> _) : Nil builder = ConfigBuilder.new yield builder @config = builder.build