Nested suite / describe / given
Abdillah opened this issue · 4 comments
From older version and the README example, I see that suite
/describe
/given
can be nested, but on 1.0.0-beta4
it doesn't.
::rspec::run(&::rspec::given("a Calculator", environment, |ctx| {
ctx.given("calculation time constraint 4ms", |ctx| {
ctx.when("squareroot-ing 5 digits number", |ctx| {
ctx.then("it is correctly find the value", |env| {
assert!(true)
});
});
});
that doesn't work:
error[E0599]: no method named `given` found for type `&mut rspec::block::Context<generator::tests::test_generator::Environment>` in the current scope
May I call it feature regression?
You can only nest context
/describe
/when
. Try changing ctx.given
to ctx.when
.
Yeah, I change my given
to when
by now.
Unfortunately, describe
can not be nested as per your comment and as the README.md sampled. It's nestable on older version though.
You’re right. It’s not describe
but specify
that can be nested. I only ever use given-when-then personally, and didn’t look up the proper names for the other flavors.
The snippet in the README is clearly wrong. Fixed: #45
Overall the behavior is intended. Suites form the trunk of a test suite. Contexts form the nestable hierarchy branches within a suite with test at the leafs.
Thanks for the clarification.
Case closed then.