API Dock says that "share_examples_for" is deprecated. If that's correct, what should we be using instead? http://apidock.com/rspec/Spec/Extensions/Main/share_examples_for Thanks, Nick
on 2010-03-06 23:31
on 2010-03-07 00:43
describe "something something", :shared => true do ... end describe "chunky bacon" do it_should_behave_like "something something" end
on 2010-03-07 00:45
Pat Maddox wrote: > describe "something something", :shared => true do > ... > end > > describe "chunky bacon" do > it_should_behave_like "something something" > end Thanks, mate.
on 2010-03-07 05:21
Pat Maddox wrote: > describe "something something", :shared => true do > ... > end > > describe "chunky bacon" do > it_should_behave_like "something something" > end BTW, is rspec.info supposed to be up-to-date? It still recommends using "shared_examples_for". http://rspec.info/documentation/
on 2010-03-07 13:46
On Sat, Mar 6, 2010 at 10:21 PM, Nick Hoffman <lists@ruby-forum.com> wrote: > "shared_examples_for". > > http://rspec.info/documentation/ So this presents an interesting problem :) My intent some time back was to deprecate :shared => true, not share_examples_for (which is aliased with shared_examples_for). Based on that, the rspec.info site is correct and Pat is incorrect. However, Pat didn't know that because I never communicated it in any other way besides documenting the method on the site. Now as we're introducing rspec-2 to the mix, option hashes passed to describe and it will become much more common. On the grounds that it would simplify the API, it seems to me it might make more sense in rspec-2 to use :shared => true and get rid of these methods. Thoughts? David
on 2010-03-07 15:59
David Chelimsky wrote: > So this presents an interesting problem :) > > My intent some time back was to deprecate :shared => true, not > share_examples_for (which is aliased with shared_examples_for). Based > on that, the rspec.info site is correct and Pat is incorrect. However, > Pat didn't know that because I never communicated it in any other way > besides documenting the method on the site. > > Now as we're introducing rspec-2 to the mix, option hashes passed to > describe and it will become much more common. On the grounds that it > would simplify the API, it seems to me it might make more sense in > rspec-2 to use :shared => true and get rid of these methods. > > Thoughts? > > David I'm a fan of "shared_examples_for", because it's beautifully descriptive of what the purpose of its block is: sharing its examples with other example groups. Passing ":shared => true" to a "describe" is less obvious to me, simply because it doesn't stand out. This is especially true when ":shared => true" is at the end of a long string. Eg: http://pastie.org/858196 Cheers, Nick
on 2010-03-15 21:01
I think what is easiest/cleanest in the code should prevail :) I personally like "shared_examples_for", but can easily adapt to whatever decision is made. On a semi-related note. Where do I require my shared specs so it_should_behave_like can find my shared example groups? Is there any convention for this? Cheers, Mike.
on 2010-03-15 21:40
emdub wrote: > I think what is easiest/cleanest in the code should prevail :) I > personally like "shared_examples_for", but can easily adapt to > whatever decision is made. > > On a semi-related note. Where do I require my shared specs so > it_should_behave_like can find my shared example groups? Is there any > convention for this? > > Cheers, > > Mike. Here you go, mate: http://pastie.org/870928
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.