[rspec-users] RSpec Requestable Examples

David Chelimsky dchelimsky at gmail.com
Sat Jan 28 17:56:50 EST 2012

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

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

  it "does another thing sometimes", :selectable do
    # ...

  it "does one other thing all the time" do
    # ...

That way we don't need a new method name to worry about and my issue
with the name "requestable_it" goes away.


> 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