-
-
Save jsteinshouer/2d42eda57b50af901b56bb5dc31555f1 to your computer and use it in GitHub Desktop.
Initial Snapshot tests for Legacy CFML refactor
This file contains 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
/** | |
* 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