[rspec-users] Options Hash explanation ?
mortench at gmail.com
Tue May 12 13:14:24 EDT 2009
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?
F.x. I have some identical examples that I need to run against a wide
range of different models that have two configuration parameters that
sometimes differ. I am thus thinking of using the has like this in
example groups (tptions which are recoginzed in helpers, macros etc):
describe XXXX-MODEL, :fixturesRelativeRootDir =>
‘testfixtures’, :serviceDescriptorRelativePath => ‘services/
Does usage of custom options like this make sense rspec-wise ?
Finally, I did find out myself that I can get the hash from a helper’s
Spec::Runner.configure.config.before(:all) using “self.class”.
However, this does not work inside nested “it” constructs. Any advice ?
More information about the rspec-users