Configure the configure()
method for production
Verify the environment
structures
Add the development()
method settings
function development ( ) {
coldbox . customErrorTemplate = "/coldbox/system/includes/BugReport.cfm" ;
coldbox . handlersIndexAutoreload = true ;
coldbox . reinitPassword = "" ;
coldbox . handlerCaching = false ;
coldbox . viewCaching = false ;
coldbox . eventCaching = false ;
}
Open the layouts/Main.cfm
and add a tag for the environment
< div class ="badge badge-info ">
#getSetting( "environment" )#
</ div >
http://localhost:42518?fwreinit=1
What is cached?
Singletons
Handlers
View/Event Caching
Change the environments, test the label
Show routes file. Explain routing by convention.
Explain event
, rc
, and prc
.
Explain views. Point out view conventions.
Briefly touch on layouts.
Show how rc
and prc
are used in the views.
coldbox create view about/index
Add an views/about/index.cfm
. Hit the url /about/index
and it works!
< cfoutput >
< h1 > About us!</ h1 >
</ cfoutput >
Add an about
handler, change to non-existent view, does it work?
coldbox create handler name=" about" actions=" index" views=false
Set it back to the index
view, does it work?
Execute the tests, we have more tests now
Explain Integration Testing, BDD Specs, Expectations
Fix the tests
it ( "can render the about page" , function ( ) {
//var event = execute( event="about.index", renderResults=true );
//var event = execute( route="/about/index", renderResults=true );
var event = GET ( "/about" ) ;
expect ( event . getRenderedContent ( ) ) . toInclude ( "About Us" ) ;
} ) ;
Assignment: Add a Links page
Assignment: Change prc.welcome
in the handlers/main.cfc
and update the integration tests to pass.