Created
February 2, 2015 10:06
-
-
Save aliaspooryorik/67aa3a87d70d79a75409 to your computer and use it in GitHub Desktop.
testbox bdd
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
component extends="testbox.system.BaseSpec" { | |
function beforeTests(){ | |
cut = fooTest(); | |
} | |
function run( testResults, testBox ){ | |
describe("A spec", function() { | |
beforeEach(function(string currentSpec) { | |
coldbox = 22; | |
}); | |
afterEach(function(string currentSpec) { | |
coldbox = 0; | |
}); | |
aroundEach(function(struct spec, struct suite){ | |
// execute the spec | |
transaction { | |
try { | |
arguments.spec.body(); | |
} catch(any e) { | |
} finally { | |
transaction action="rollback"; | |
} | |
} | |
}); | |
it("is just a function, so it can contain any code", function() { | |
expect( coldbox ).toBe( 22 ); | |
expect( cut ).toBeComponent(); | |
expect( cut ).toBeInstanceOf("unittests.foo.fooTest"); | |
}); | |
it("can have more than one expectation and talk to scopes", function() { | |
expect( coldbox ).toBe( 22 ); | |
}); | |
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 ); | |
}); | |
}); | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment