test/tilt_csv_test.rb in tilt-2.0.1 vs test/tilt_csv_test.rb in tilt-2.0.2

- old
+ new

@@ -45,9 +45,21 @@ file, line, meth = line.split(":") assert_equal '4', line end end + test "passing options to engine" do + template = Tilt::CSVTemplate.new(:col_sep => '|') { 'csv << [1,2,3]' } + assert_equal "1|2|3\n", template.render + end + + test "outvar option" do + outvar = '@_output' + scope = Object.new + template = Tilt::CSVTemplate.new(:outvar => outvar) { 'csv << [1,2,3]' } + output = template.render(scope) + assert_equal output, scope.instance_variable_get(outvar.to_sym) + end end rescue LoadError => boom warn "Tilt::CSVTemplate (disabled) please install 'fastercsv' if using ruby 1.8.x" end