-
Notifications
You must be signed in to change notification settings - Fork 197
Expand file tree
/
Copy pathtest_jammit_controller.rb
More file actions
45 lines (37 loc) · 1.28 KB
/
test_jammit_controller.rb
File metadata and controls
45 lines (37 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
$: << File.expand_path(File.dirname(__FILE__) + "/..") ; require 'test_helper'
require 'active_support'
require 'action_pack'
require 'action_controller'
require 'action_controller/base'
require 'action_controller/test_case'
require 'jammit/controller'
require 'jammit/routes'
class JammitController
def self.controller_path
"jammit"
end
end
class JammitControllerTest < ActionController::TestCase
CACHE_DIR = '/tmp/jammit_controller_test'
def setup
FileUtils.mkdir_p CACHE_DIR
ActionController::Base.page_cache_directory = CACHE_DIR
ActionController::Routing::Routes.draw do |map|
Jammit::Routes.draw(map)
end
Jammit.load_configuration('test/config/assets.yml').reload!
end
def teardown
FileUtils.remove_entry_secure CACHE_DIR
end
def test_package_with_jst
get(:package, :package => 'jst_test', :extension => 'jst')
assert @response.headers['Content-Type'] =~ /text\/javascript/
assert @response.body == File.read("#{ASSET_ROOT}/fixtures/jammed/jst_test.js")
end
def test_package_with_jst_mixed
get(:package, :package => 'js_test_with_templates', :extension => 'jst')
assert @response.headers['Content-Type'] =~ /text\/javascript/
assert @response.body == File.read("#{ASSET_ROOT}/fixtures/jammed/jst_test.js")
end
end