[rspec-users] RSpec Requestable Examples

Zach Dennis zach.dennis at gmail.com
Sat Jan 28 23:27:53 EST 2012

On Sat, Jan 28, 2012 at 5:56 PM, David Chelimsky <dchelimsky at gmail.com> wrote:
> On Fri, Jan 27, 2012 at 8:56 PM, Zach Dennis <zach.dennis at gmail.com> wrote:
>> 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 agree with you, "selectable" seems like a better fit, but this may
not apply in its entirety given your next suggestion...

> 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.

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,


>> Here's the post that introduces them:
>> http://mutuallyhuman.com/blog/2012/01/27/rspec-requestable-examples
>> Git repository: https://github.com/mhs/rspec-requestable-examples
>> --
>> Zach Dennis
>> http://www.continuousthinking.com
>> http://www.mutuallyhuman.com
>> @zachdennis (twitter)
>> _______________________________________________
>> rspec-users mailing list
>> rspec-users at rubyforge.org
>> http://rubyforge.org/mailman/listinfo/rspec-users



More information about the rspec-users mailing list