Skip to content

Commit

Permalink
use the tmp filesystem rather than our own thing.
Browse files Browse the repository at this point in the history
  • Loading branch information
tenderlove committed Oct 17, 2012
1 parent bf876af commit d410ac5
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions actionpack/test/template/digestor_test.rb
Expand Up @@ -13,20 +13,24 @@ def initialize(template_path)


class FixtureFinder class FixtureFinder
FIXTURES_DIR = "#{File.dirname(__FILE__)}/../fixtures/digestor" FIXTURES_DIR = "#{File.dirname(__FILE__)}/../fixtures/digestor"
TMP_DIR = "#{File.dirname(__FILE__)}/../tmp"


def find(logical_name, keys, partial, options) def find(logical_name, keys, partial, options)
FixtureTemplate.new("#{TMP_DIR}/digestor/#{partial ? logical_name.gsub(%r|/([^/]+)$|, '/_\1') : logical_name}.#{options[:formats].first}.erb") FixtureTemplate.new("digestor/#{partial ? logical_name.gsub(%r|/([^/]+)$|, '/_\1') : logical_name}.#{options[:formats].first}.erb")
end end
end end


class TemplateDigestorTest < ActionView::TestCase class TemplateDigestorTest < ActionView::TestCase
def setup def setup
FileUtils.cp_r FixtureFinder::FIXTURES_DIR, FixtureFinder::TMP_DIR @cwd = Dir.pwd
@tmp_dir = Dir.mktmpdir

FileUtils.cp_r FixtureFinder::FIXTURES_DIR, @tmp_dir
Dir.chdir @tmp_dir
end end


def teardown def teardown
FileUtils.rm_r File.join(FixtureFinder::TMP_DIR, "digestor") Dir.chdir @cwd
FileUtils.rm_r @tmp_dir
ActionView::Digestor.cache.clear ActionView::Digestor.cache.clear
end end


Expand Down Expand Up @@ -159,7 +163,7 @@ def digest(template_name)
end end


def change_template(template_name) def change_template(template_name)
File.open("#{FixtureFinder::TMP_DIR}/digestor/#{template_name}.html.erb", "w") do |f| File.open("digestor/#{template_name}.html.erb", "w") do |f|
f.write "\nTHIS WAS CHANGED!" f.write "\nTHIS WAS CHANGED!"
end end
end end
Expand Down

0 comments on commit d410ac5

Please sign in to comment.