Skip to content

Instantly share code, notes, and snippets.

Created Apr 25, 2016
What would you like to do?
How to test erb templates with ruby
<%= conditon ? 'True case' : 'False case' %>)
require 'erb'
condition = false
template ="test.erb"), nil, "%"
puts template.result(binding)
Copy link

fabianvf commented Apr 25, 2016

then just run ruby test.rb

Copy link

deepakduggirala commented Jan 24, 2018

condition spelled wrong in test.erb

<%= conditon ? 'True case' : 'False case' %>) should be <%= condition ? 'True case' : 'False case' %>)

Copy link

jimbo8098 commented Jan 27, 2020

Still relevant to this day, thanks for this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment