I would be interested to hear any thoughts from the community about
the ability to request specific examples from a shared example group
as expressed in the rspec-requestable-examples gem.
I would be interested to hear any thoughts from the community about
the ability to request specific examples from a shared example group
as expressed in the rspec-requestable-examples gem.
I love the service it provides, and the consuming API (i.e. :examples
=> […]). It clearly communicates to the spec reader what is going
on.
As for the setup API, how about “requestable_example” instead of
“requestable_it”. In fact, I think “selectable” would be a more
accurate descriptor than “requestable”, so “selectable_examples_for”
and “selectable_example” would read better for me.
I haven’t looked at the implementation yet, but I wonder if you could
implement the same feature using metadata. Something like this, using
“selectable” rather than “requestable” (seems better aligned with what
it’s doing IMO):
shared_examples_for “variable things”, :selectable do
it “does one thing sometimes”, :selectable do
# …
end
it “does another thing sometimes”, :selectable do
# …
end
it “does one other thing all the time” do
# …
end
end
That way we don’t need a new method name to worry about and my issue
with the name “requestable_it” goes away.
“requestable_it”. In fact, I think “selectable” would be a more
accurate descriptor than “requestable”, so “selectable_examples_for”
and “selectable_example” would read better for me.
I agree with you, “selectable” seems like a better fit, but this may
not apply in its entirety given your next suggestion…
with the name “requestable_it” goes away.
WDYT?
I like what you’re suggesting here as well. One reason I had went with
a new method name for this was to not conflict with RSpec itself, but
given your feedback I will investigate what you propose above.
Thanks for taking the time to review and to respond,
I would be interested to hear any thoughts from the community about
the ability to request specific examples from a shared example group
as expressed in the rspec-requestable-examples gem.