ruby on rails - How to define suites in rspec2 -
how define suite in rspec2. indeed, suite?
i want break specs down 2 suites , reset between running 2 suites (clean out test db, reset warden etc ..). guess can before(:suite) block.
update: understanding example like:
"should true" ... end
a group like:
describe model ... end
this understanding seems validated putting few debug statements in code. how suite defined? specs in spec folder? in case there way achieve i'm trying do?
(i'm surprised can't find googling or in answers previous questions.)
as see it, there no thing suite in rspec itself. have digging around little bit , found following:
- there post called "my top 7 rspec best practices" find under section 6 "create several test suites speed workflow". explains how split specs "suites" in rakefile , calling them individually.
- what try reach explained in book "the rspec book" david chelimsky. there in chapter 16.5 explains global hooks (before, after, around, ...) scope keyword
:suite
can used. meaning:
if :each, block run before each matching example. if :all, block run once per group, before matching examples have been run. if :suite, block run once before example groups have run.
so if divide specs in example groups, may control using eg. before(:suite) ...
should done per example group.
Comments
Post a Comment