aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/new_base/test_helper.rb
diff options
context:
space:
mode:
authorCarl Lerche <carllerche@mac.com>2009-03-20 14:43:19 -0700
committerYehuda Katz <wycats@gmail.com>2009-03-23 10:23:14 -0700
commit90c079a7814a9a996c8cbe353015c080fafce2bc (patch)
tree9413b704e093b00abb283e39dc06066f95c54597 /actionpack/test/new_base/test_helper.rb
parentdc96ba8043298fdd598b8ef68e07c41f0e82d5ce (diff)
downloadrails-90c079a7814a9a996c8cbe353015c080fafce2bc.tar.gz
rails-90c079a7814a9a996c8cbe353015c080fafce2bc.tar.bz2
rails-90c079a7814a9a996c8cbe353015c080fafce2bc.zip
Modified the action layout tests to use the new FixtureTemplate class
Diffstat (limited to 'actionpack/test/new_base/test_helper.rb')
-rw-r--r--actionpack/test/new_base/test_helper.rb36
1 files changed, 36 insertions, 0 deletions
diff --git a/actionpack/test/new_base/test_helper.rb b/actionpack/test/new_base/test_helper.rb
index af790aa5dd..affb52a432 100644
--- a/actionpack/test/new_base/test_helper.rb
+++ b/actionpack/test/new_base/test_helper.rb
@@ -50,6 +50,42 @@ module ActionController
end
end
+module ActionView #:nodoc:
+ class FixtureTemplate < Template
+ class FixturePath < Template::Path
+ def initialize(hash)
+ @hash = {}
+
+ hash.each do |k, v|
+ @hash[k.sub(/\.\w+$/, '')] = FixtureTemplate.new(v, k.split("/").last, self)
+ end
+
+ super("")
+ end
+
+ def find_template(path)
+ @hash[path]
+ end
+ end
+
+ def initialize(body, *args)
+ @body = body
+ super(*args)
+ end
+
+ def source
+ @body
+ end
+
+ private
+
+ def find_full_path(path, load_paths)
+ return '/', path
+ end
+
+ end
+end
+
# Temporary base class
class Rack::TestCase < ActiveSupport::TestCase
include Rack::Test::Methods