4 Matching Annotations
- May 2022
-
github.com github.com
-
I think RSpec should provide around(:context)/around(:all). Not because of any particular use case, but simply for API consistency. It's much simpler to tell users "there are 3 kinds of hooks (before, after and around) and each can be used with any of 3 scopes (example, context and suite)". Having some kinds of hooks work with only some kinds of scopes makes the API inconsistent and forces us to add special case code to emit warnings and also write extra documentation for this fact.
-
I've been thinking of looking into implementing this in rspec-core, primarily to make the API more consistent (e.g. so that you can combine any scope -- example/context/suite -- with any hook type before/after/around).
-
- Mar 2021
-
bugs.ruby-lang.org bugs.ruby-lang.org
-
If this is okay, then it might even be nice if #dig took a block as well as a fallback value: [].dig(1) { 'default' } #=> "default"
-
Would it be desirable to specify the new object in a block? That would make it somewhat symmetrical to how Hash.new takes a block as a default value.
-