Skip to content

Conversation

ajsharp
Copy link
Owner

@ajsharp ajsharp commented Nov 24, 2013

A common use case is rendering a model's json when "bootstrapping" an html page so javascript classes / views can make use of the model data:

<div class="person">
</div>

<script>
App.person = new App.Person(<%= raw(Bldr::Template.new('appointments/show', locals: {appointment: @appointment})) %>)

App.personView = new App.PersonView(model: App.person, el: '.person')
</script>

@@ -1,6 +1,17 @@
require 'spec_helper'

module Bldr
describe '.template' do
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would expect you to be testing .template here, but you're actually testing .render. So maybe describe Template, '.render' is more clear?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. Typo :)

  • alex

On Nov 25, 2013, at 5:27 PM, Adam LaFave [email protected] wrote:

In spec/functional/tilt_template_spec.rb:

@@ -1,6 +1,17 @@
require 'spec_helper'

module Bldr

  • describe '.template' do
    I would expect you to be testing .template here, but you're actually testing .render. So maybe describe Template, '.render' is more clear?


Reply to this email directly or view it on GitHub.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants