Skip to content

Instantly share code, notes, and snippets.

Created April 25, 2016 17:33
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save fabianvf/61fd184a49067f3a3e95fd8ce5da6897 to your computer and use it in GitHub Desktop.
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

condition spelled wrong in test.erb

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

Copy link

Still relevant to this day, thanks for this!

Copy link

Thanks for this. Just what I needed.

Copy link

Et7f3 commented Mar 1, 2023

Very helpful

Copy link


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