Skip to content

Instantly share code, notes, and snippets.

@jsteinshouer
Created September 9, 2017 03:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jsteinshouer/2d42eda57b50af901b56bb5dc31555f1 to your computer and use it in GitHub Desktop.
Save jsteinshouer/2d42eda57b50af901b56bb5dc31555f1 to your computer and use it in GitHub Desktop.
Initial Snapshot tests for Legacy CFML refactor
/**
* My BDD Test
*/
component extends="testbox.system.BaseSpec"{
/*********************************** LIFE CYCLE Methods ***********************************/
// executes before all suites+specs in the run() method
function beforeAll(){
addMatchers( "testbox-snapshots.SnapshotMatchers" );
}
// executes after all suites+specs in the run() method
function afterAll(){
}
/*********************************** BDD SUITES ***********************************/
function run(){
describe( "RefactorApprovalTest", function(){
beforeEach(function( currentSpec ){
content = "";
/* Add some data for our tests */
queryExecute("
delete from todo;
--reset the identity so the keys match
ALTER TABLE todo ALTER COLUMN p_todo_id RESTART WITH 1;
insert into todo(p_todo_id,description,completed_date)
values
(1,'Do This',NULL),
(2,'And this',NULL),
(3,'This is done','2017-09-01 01:45:00')
");
});
it( "should display a list of to-do items", function(){
cfsavecontent(variable="content") {
include '/index.cfm';
}
expect(content).toMatchSnapshot();
});
it( "should display a list of completed to-do items", function(){
url.action = "completed";
cfsavecontent(variable="content") {
include '/index.cfm';
}
expect(content).toMatchSnapshot();
});
it( "should add a new to-do item", function(){
url.action = "add";
form.description = "another thing to do";
cfsavecontent(variable="content") {
include '/index.cfm';
}
expect(content).toMatchSnapshot();
});
it( "should complete a to-do item", function(){
url.action = "complete-todo";
form.id = 1;
cfsavecontent(variable="content") {
include '/index.cfm';
}
expect(content).toMatchSnapshot();
});
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment