Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Add integration test to confirm asset_paths are used correctly if the…

… pipeline is on.
  • Loading branch information...
commit 8fbe06aaae40e7e86d2b3d3bfeb8ccffb705780b 1 parent 9100433
Matt Wilson hypomodern authored
7 spec/controllers/stache_controller_spec.rb
@@ -23,5 +23,12 @@
23 23 # puts response.body
24 24 end
25 25
  26 + it "correctly uses the asset helpers" do
  27 + get :with_asset_helpers
  28 + assert_response 200
  29 +
  30 + response.body.should =~ /Here's an image_path=\/assets\/image\.png/
  31 + end
  32 +
26 33
27 34 end
11 spec/dummy/app/controllers/stache_controller.rb
... ... @@ -1,13 +1,18 @@
1 1 class StacheController < ApplicationController
2   -
  2 +
3 3 def index
4 4 @user = params[:user] || "Matt"
5 5 # index.html.mustache
6 6 end
7   -
  7 +
8 8 def with_partials
9 9 @user = params[:user] || "Matt"
10 10 @thing = "Grue"
11 11 end
12   -
  12 +
  13 + def with_asset_helpers
  14 + require 'with_asset_helpers'
  15 + # with_asset_helpers.html.mustache
  16 + end
  17 +
13 18 end
1  spec/dummy/app/views/stache/with_asset_helpers.html.mustache
... ... @@ -0,0 +1 @@
  1 +Here's an image_path={{my_image}}
3  spec/dummy/config/application.rb
@@ -5,6 +5,7 @@
5 5 require "action_controller/railtie"
6 6 require "action_view/railtie"
7 7 require "action_mailer/railtie"
  8 +require "sprockets/railtie"
8 9
9 10 Bundler.require
10 11
@@ -40,5 +41,7 @@ class Application < Rails::Application
40 41
41 42 # Configure sensitive parameters which will be filtered from the log file.
42 43 config.filter_parameters += [:password]
  44 +
  45 + config.assets.enabled = true
43 46 end
44 47 end
4 spec/dummy/config/routes.rb
... ... @@ -1,7 +1,9 @@
1 1 Dummy::Application.routes.draw do
2 2 get 'stache', :to => 'stache#index', :as => 'stache'
3   -
  3 +
4 4 get 'stache/with_partials', :to => 'stache#with_partials'
  5 +
  6 + get 'stache/with_asset_helpers', :to => 'stache#with_asset_helpers'
5 7 # The priority is based upon order of creation:
6 8 # first created -> highest priority.
7 9
7 spec/dummy/lib/with_asset_helpers.rb
... ... @@ -0,0 +1,7 @@
  1 +class Stache::WithAssetHelpers < Stache::View
  2 +
  3 + def my_image
  4 + @my_image ||= image_path("image.png")
  5 + end
  6 +
  7 +end

0 comments on commit 8fbe06a

Please sign in to comment.
Something went wrong with that request. Please try again.