Sha256: 8c73f2c03922df047300bd2a8133fc3ec83898a5caffa8485eb43f8310916548

Contents?: true

Size: 1.17 KB

Versions: 4

Compression:

Stored size: 1.17 KB

Contents

require 'spec_helper'

describe HandlebarsController do
  render_views

  before do
    Stache.template_base_path = ::Rails.root.join('app', 'views')
  end

  it "can get to index and render a Handlebars" do
    get :index
    assert_response 200

    response.should render_template 'index'
    response.body.should =~ /Hello, Matt!/
  end

  it "can render using a module wrapper" do
    begin
      Stache.wrapper_module_name = "Wrapper"

      get :with_wrapper
      assert_response 200

      response.should render_template 'with_wrapper'
      response.body.should =~ /answer: Yes/
    ensure
      Stache.wrapper_module_name = nil
    end
  end

  it "correctly renders partials" do
    get :with_partials
    assert_response 200

    response.body.should =~ /Grue/
    # puts response.body
  end

  it "correctly uses helpers" do
    get :with_helpers
    assert_response 200

    response.body.should =~ /Here's an image_path=\/images\/image\.png/
    response.body.should =~ /Here's a capitalized string: Lowercase/
  end

  it "doesn't blow up if it is missing data" do
    get :with_missing_data
    assert_response 200

    response.body.should =~ /I should not \./
  end


end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
stache-1.2.0 spec/controllers/handlebars_controller_spec.rb
stache-1.1.1 spec/controllers/handlebars_controller_spec.rb
stache-1.1.0 spec/controllers/handlebars_controller_spec.rb
stache-1.0.3 spec/controllers/handlebars_controller_spec.rb