66describe Handlebars ::Handlebars do
77 let ( :hbs ) { Handlebars ::Handlebars . new }
88
9- def evaluate ( template , args = { } )
10- hbs . compile ( template ) . call ( args )
9+ def evaluate ( template , args = { } , ** compiling_options )
10+ hbs . compile ( template , ** compiling_options ) . call ( args )
1111 end
1212
1313 context 'evaluating' do
@@ -51,6 +51,12 @@ def evaluate(template, args = {})
5151 expect ( evaluate ( 'Hello {{first-name}}' , double ( "first-name" : 'world' ) ) ) . to eq ( 'Hello world' )
5252 end
5353
54+ context 'strict mode' do
55+ it 'raises an error' do
56+ expect { evaluate ( 'Hello {{you}}' , { } , strict : true ) } . to raise_error ( Handlebars ::Context ::AttributeNotFoundError )
57+ end
58+ end
59+
5460 context 'partials' do
5561 it 'simple' do
5662 hbs . register_partial ( 'plic' , "Plic" )
@@ -71,7 +77,7 @@ def evaluate(template, args = {})
7177 hbs . register_partial ( 'brackets' , "[{{name}}]" )
7278 expect ( evaluate ( "Hello {{> brackets}}" , { name : 'world' } ) ) . to eq ( "Hello [world]" )
7379 end
74-
80+
7581 it 'with a string argument' do
7682 hbs . register_partial ( 'with_args' , "[{{name}}]" )
7783 expect ( evaluate ( "Hello {{> with_args name='jon'}}" ) ) . to eq ( "Hello [jon]" )
0 commit comments