On 13 Maj, 01:14, Randy Harmon <r_j_h_box...@yahoo.com> wrote: > mortench wrote: > > The new rspec beta book and the rspec site mentions that it is > > possible to add a hash to "describe" and "it" constructs but very, > > very litle information about the particulars. > > > What can the options hash be used for and what should it be used for? > > This might be used for tagging examples, marking examples for use with > formatters, or other purposes probably not bearing on spec execution.
"not bearing on spec execution". I.e. for meta-data only. Any official word on thos? > I'm not saying they could or couldn't be used the way you're suggesting, > but there are other possibilities you should try first IMO. Ok. Thanks for the advice. > I have used a callback for this, but I understand that rspec 1.2 has > macros that can take args the way your shared example can't. I haven't > dug into them. Ok. will look into that. > Here's the callback approach demonstrated. > > describe "shared", :shared => true > it "..." do > options = shared_options() > ... > end > end > > describe "thingy" > it_should_behave_like "shared" > def shared_options > { :foo => 'bar', :baz => 'buz } > end > end Thanks for the suggestion. I can see how it world work, but for this particular problem I have (where 3parties would need to reuse my tests), I would like something that not only works but is also simple and elegant.... And the above is a bit verbose I think compared to just describe "thingy", :foo => 'bar', :baz => 'buz ... end _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users