BDD
function run( testResults, testBox ){
describe("A suite", function(){
it("contains spec with an awesome expectation", function(){
expect( true ).toBeTrue();
});
});
}describe("A spec", function() {
beforeEach(function() {
coldbox = 22;
application.wirebox = new coldbox.system.ioc.Injector();
});
afterEach(function() {
coldbox = 0;
structDelete( application, "wirebox" );
});
it("is just a function, so it can contain any code", function() {
expect( coldbox ).toBe( 22 );
});
it("can have more than one expectation and talk to scopes", function() {
expect( coldbox ).toBe( 22 );
expect( application.wirebox.getInstance( 'MyService' ) ).toBeComponent();
});
describe("nested inside a second describe", function() {
beforeEach(function() {
awesome = 22;
});
afterEach(function() {
awesome = 22 + 8;
});
it("can reference both scopes as needed ", function() {
expect( coldbox ).toBe( awesome );
});
});
it("can be declared after nested suites and have access to nested variables", function() {
expect( awesome ).toBe( 30 );
});
});BDD Specs
Last updated
Was this helpful?