Skip to content

Instantly share code, notes, and snippets.

@tombruijn
Created November 9, 2012 10:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tombruijn/4045037 to your computer and use it in GitHub Desktop.
Save tombruijn/4045037 to your computer and use it in GitHub Desktop.
Konacha testing setup for output
# spec/javascripts/templates/hello.jst.eco
<h1>Hello <%= @name %>!</h1>
# Eco uses instance variables for variables given by the test
# spec/javascripts/my_test_spec.js.coffee
#= require spec_helper
describe "templating", ->
it "is built in to Sprockets", ->
$('body').html(JST['templates/hello']({ name: '80beans' })) # name becomes instance variable
$('body h1').text().should.equal('Hello 80beans!')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment