The Context module holds all the functionality for the test declaration, that is: describe
,
before
, after
, it
and their variants.
Running these tests and doing asserts is not the job of the Context.
use rspec::context::*;
rdescribe("Context", |ctx| {
describe("Context::describe", |ctx| {
ctx.it("can be nested", || Ok(()));
ctx.it("use a `ctx` object", || Ok(()))
});
describe("Context::it", |ctx| {
ctx.it("uses a Result returns", || Ok(()));
ctx.it("can also use asserts", || {
assert_eq!(42, 12 + 30);
Ok(())
})
});
});