Thank you for your 'late' reply... allow me to reply even later (10 months
after your reply ^_^').
One problem I encountered, is that RSpec seems to require that examples are
*first* created, and only *then* they are all run. Is this true?
For property-testing it makes sense to run the tests for a particular
property only until the first failure occurs (and at that time we'd want to
shrink the input back to the most basic input that creates the same error).
Is this approach fundamentally incompatible with RSpec's architecture, or
is there some way to do this? ('this' being to define more tests on the
fly.)
~Marten/Qqwy
On Tuesday, September 3, 2019 at 5:23:31 PM UTC+2, Jon Rowe wrote:
>
> Each `describe` / `context` creates a class, each test is an instance. You
> can create (with your own DSL) a module thats mixed into the class to
> provide the functionality you want.
>
> I’d be creating each additional hook as a non memoized method, then having
> a `propcheck` or similar DSL which is invoked with test that calls these
> methods each time the block is invoked.
>
> Apologies for the delayed response, under a pile of mail atm!
>
> Cheers
> Jon Rowe
> ---------------------------
> [email protected] <javascript:>
> jonrowe.co.uk
>
> On 30 June 2019 at 09:11, Wiebe-Marten Wijnja wrote:
>
> All right, I am currently considering an alternate approach, in which
> someone can
>
> Rspec.describe MyFancyStuff do
>
>
> ...
>
>
> # In any (nested or not) ExampleGroup:
>
>
> require 'prop_check/rspec'
>
> extend
> PropCheck::RSpec
>
>
> ...
> end
>
> to bring not only `forall` into scope, but also override
> `before/after/around` to handle one extra context, which I have tentatively
> called `:each_prop_check_iteration`.
>
> The thing I am currently struggling with however, is how to correctly keep
> track of the blocks that someone wants to add as hooks, and then to call
> them correctly from within an example context
>
> (Or, to be precise: From within a block within an `it "description" do ...
> end`)
> At first I attempted adding instance methods, which did not work because
> each example runs its own instance.
> Then I attempted working with class-methods on the ExampleGroup, which did
> not work because by default when an example runs it prevents methods that
> are not part of the `ExampleGroup` class itself from being run, raising a
> WrongScopeError (see e.g.
> github.com/rspec/rspec-core/blob/2a62a644b52536d44a7969b5c5b69077a35687ca/lib/rspec/core/example_group.rb#L730
> ).
>
> Then I tried adding it to the `metadata`, but you do not have access to it
> from within a running example unless you have full control over the block
> that `it` is being called with (the only way to access the example's
> metadata is if you specify a parameter to the block you pass to `it`).
>
>
> What would be the way to accomplish this?
>
>
> On Saturday, June 29, 2019 at 3:23:08 PM UTC+2, Jon Rowe wrote:
>
>
--
You received this message because you are subscribed to the Google Groups
"rspec" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/rspec/de43cba2-7e2f-4771-9eee-3b4167b0070co%40googlegroups.com.