Skip to content

Instantly share code, notes, and snippets.

@fabianvf
Created April 25, 2016 17:33
Show Gist options
  • Save fabianvf/61fd184a49067f3a3e95fd8ce5da6897 to your computer and use it in GitHub Desktop.
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 = ERB.new File.read("test.erb"), nil, "%"
puts template.result(binding)
@jimbo8098
Copy link

Still relevant to this day, thanks for this!

@flynn1982
Copy link

Thanks for this. Just what I needed.

@Et7f3
Copy link

Et7f3 commented Mar 1, 2023

Very helpful

@irridescentrambler
Copy link

Thanks

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