aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/template
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/test/template')
-rw-r--r--actionpack/test/template/active_record_helper_test.rb14
-rw-r--r--actionpack/test/template/atom_feed_helper_test.rb1
-rw-r--r--actionpack/test/template/body_parts_test.rb13
-rw-r--r--actionpack/test/template/capture_helper_test.rb15
-rw-r--r--actionpack/test/template/compiled_templates_test.rb2
-rw-r--r--actionpack/test/template/form_helper_test.rb4
-rw-r--r--actionpack/test/template/prototype_helper_test.rb3
-rw-r--r--actionpack/test/template/record_tag_helper_test.rb1
-rw-r--r--actionpack/test/template/render_test.rb29
-rw-r--r--actionpack/test/template/test_test.rb1
-rw-r--r--actionpack/test/template/url_helper_test.rb2
11 files changed, 41 insertions, 44 deletions
diff --git a/actionpack/test/template/active_record_helper_test.rb b/actionpack/test/template/active_record_helper_test.rb
index b4b8cbe074..4691049a41 100644
--- a/actionpack/test/template/active_record_helper_test.rb
+++ b/actionpack/test/template/active_record_helper_test.rb
@@ -33,8 +33,8 @@ class ActiveRecordHelperTest < ActionView::TestCase
["Author name can't be <em>empty</em>"]
end
- def on(field)
- "can't be <em>empty</em>"
+ def [](field)
+ ["can't be <em>empty</em>"]
end
end
@@ -47,14 +47,14 @@ class ActiveRecordHelperTest < ActionView::TestCase
@post = Post.new
def @post.errors
Class.new {
- def on(field)
+ def [](field)
case field.to_s
when "author_name"
- "can't be empty"
+ ["can't be empty"]
when "body"
- true
+ ['foo']
else
- false
+ []
end
end
def empty?() false end
@@ -85,7 +85,7 @@ class ActiveRecordHelperTest < ActionView::TestCase
@user = User.new
def @user.errors
Class.new {
- def on(field) field == "email" end
+ def [](field) field == "email" ? ['nonempty'] : [] end
def empty?() false end
def count() 1 end
def full_messages() [ "User email can't be empty" ] end
diff --git a/actionpack/test/template/atom_feed_helper_test.rb b/actionpack/test/template/atom_feed_helper_test.rb
index bd97caf5d7..6f1179f359 100644
--- a/actionpack/test/template/atom_feed_helper_test.rb
+++ b/actionpack/test/template/atom_feed_helper_test.rb
@@ -1,6 +1,7 @@
require 'abstract_unit'
Scroll = Struct.new(:id, :to_param, :title, :body, :updated_at, :created_at)
+Scroll.extend ActiveModel::Naming
class ScrollsController < ActionController::Base
FEEDS = {}
diff --git a/actionpack/test/template/body_parts_test.rb b/actionpack/test/template/body_parts_test.rb
index 4e7aa63f96..bac67c1a7d 100644
--- a/actionpack/test/template/body_parts_test.rb
+++ b/actionpack/test/template/body_parts_test.rb
@@ -4,9 +4,8 @@ class BodyPartsTest < ActionController::TestCase
RENDERINGS = [Object.new, Object.new, Object.new]
class TestController < ActionController::Base
- def performed?
- defined?(ActionController::Http) ? true : super
- end
+ def performed?() true end
+
def index
RENDERINGS.each do |rendering|
@template.punctuate_body! rendering
@@ -19,11 +18,9 @@ class BodyPartsTest < ActionController::TestCase
def test_body_parts
get :index
- pending(:old_base) do
- # TestProcess buffers body_parts into body
- # TODO: Rewrite test w/o going through process
- assert_equal RENDERINGS, @response.body_parts
- end
+ # TestProcess buffers body_parts into body
+ # TODO: Rewrite test w/o going through process
+ assert_equal RENDERINGS, @response.body_parts
assert_equal RENDERINGS.join, @response.body
end
end
diff --git a/actionpack/test/template/capture_helper_test.rb b/actionpack/test/template/capture_helper_test.rb
new file mode 100644
index 0000000000..2017a18806
--- /dev/null
+++ b/actionpack/test/template/capture_helper_test.rb
@@ -0,0 +1,15 @@
+require 'abstract_unit'
+
+class CaptureHelperTest < ActionView::TestCase
+ def setup
+ super
+ @_content_for = Hash.new {|h,k| h[k] = "" }
+ end
+
+ def test_content_for
+ assert ! content_for?(:title)
+ content_for :title, 'title'
+ assert content_for?(:title)
+ assert ! content_for?(:something_else)
+ end
+end
diff --git a/actionpack/test/template/compiled_templates_test.rb b/actionpack/test/template/compiled_templates_test.rb
index b29b03f99d..9c268aef27 100644
--- a/actionpack/test/template/compiled_templates_test.rb
+++ b/actionpack/test/template/compiled_templates_test.rb
@@ -41,7 +41,7 @@ class CompiledTemplatesTest < Test::Unit::TestCase
end
def render_without_cache(*args)
- path = ActionView::Template::FileSystemPathWithFallback.new(FIXTURE_LOAD_PATH)
+ path = ActionView::FileSystemResolverWithFallback.new(FIXTURE_LOAD_PATH)
view_paths = ActionView::Base.process_view_paths(path)
ActionView::Base.new(view_paths, {}).render(*args)
end
diff --git a/actionpack/test/template/form_helper_test.rb b/actionpack/test/template/form_helper_test.rb
index 947668ccc6..f8215132e3 100644
--- a/actionpack/test/template/form_helper_test.rb
+++ b/actionpack/test/template/form_helper_test.rb
@@ -50,7 +50,7 @@ class FormHelperTest < ActionView::TestCase
@comment = Comment.new
def @post.errors()
Class.new{
- def on(field); "can't be empty" if field == "author_name"; end
+ def [](field); field == "author_name" ? ["can't be empty"] : [] end
def empty?() false end
def count() 1 end
def full_messages() [ "Author name can't be empty" ] end
@@ -1193,4 +1193,4 @@ class FormHelperTest < ActionView::TestCase
def protect_against_forgery?
false
end
-end \ No newline at end of file
+end
diff --git a/actionpack/test/template/prototype_helper_test.rb b/actionpack/test/template/prototype_helper_test.rb
index f9f418aec9..02b1d137f5 100644
--- a/actionpack/test/template/prototype_helper_test.rb
+++ b/actionpack/test/template/prototype_helper_test.rb
@@ -1,8 +1,10 @@
require 'abstract_unit'
Bunny = Struct.new(:Bunny, :id)
+Bunny.extend ActiveModel::Naming
class Author
+ extend ActiveModel::Naming
attr_reader :id
def save; @id = 1 end
def new_record?; @id.nil? end
@@ -12,6 +14,7 @@ class Author
end
class Article
+ extend ActiveModel::Naming
attr_reader :id
attr_reader :author_id
def save; @id = 1; @author_id = 1 end
diff --git a/actionpack/test/template/record_tag_helper_test.rb b/actionpack/test/template/record_tag_helper_test.rb
index 809ed6d6af..5b840d123b 100644
--- a/actionpack/test/template/record_tag_helper_test.rb
+++ b/actionpack/test/template/record_tag_helper_test.rb
@@ -1,6 +1,7 @@
require 'abstract_unit'
class Post
+ extend ActiveModel::Naming
def id
45
end
diff --git a/actionpack/test/template/render_test.rb b/actionpack/test/template/render_test.rb
index 2ed11aa3c0..7f30ae88a1 100644
--- a/actionpack/test/template/render_test.rb
+++ b/actionpack/test/template/render_test.rb
@@ -46,29 +46,6 @@ module RenderTestCases
I18n.locale = old_locale
end
- def test_render_implicit_html_template_from_xhr_request
- old_format = @view.formats
- pending do
- @view.formats = [:js]
- assert_equal "Hello HTML!", @view.render(:file => "test/render_implicit_html_template_from_xhr_request")
- end
- ensure
- @view.formats = old_format
- end
-
- def test_render_implicit_html_template_from_xhr_request_with_localization
- old_locale = I18n.locale
- old_format = @view.formats
- pending do
- I18n.locale = :da
- @view.formats = [:js]
- assert_equal "Hey HTML!\n", @view.render(:file => "test/render_implicit_html_template_from_xhr_request")
- end
- ensure
- I18n.locale = old_locale
- @view.formats = old_format
- end
-
def test_render_file_at_top_level
assert_equal 'Elastica', @view.render(:file => '/shared')
end
@@ -278,7 +255,7 @@ class CachedViewRenderTest < ActiveSupport::TestCase
# Ensure view path cache is primed
def setup
view_paths = ActionController::Base.view_paths
- assert_equal ActionView::Template::FileSystemPathWithFallback, view_paths.first.class
+ assert_equal ActionView::FileSystemResolverWithFallback, view_paths.first.class
setup_view(view_paths)
end
end
@@ -289,9 +266,9 @@ class LazyViewRenderTest < ActiveSupport::TestCase
# Test the same thing as above, but make sure the view path
# is not eager loaded
def setup
- path = ActionView::Template::FileSystemPathWithFallback.new(FIXTURE_LOAD_PATH)
+ path = ActionView::FileSystemResolverWithFallback.new(FIXTURE_LOAD_PATH)
view_paths = ActionView::Base.process_view_paths(path)
- assert_equal ActionView::Template::FileSystemPathWithFallback, view_paths.first.class
+ assert_equal ActionView::FileSystemResolverWithFallback, view_paths.first.class
setup_view(view_paths)
end
end
diff --git a/actionpack/test/template/test_test.rb b/actionpack/test/template/test_test.rb
index dd07a6d438..f32d0b3d42 100644
--- a/actionpack/test/template/test_test.rb
+++ b/actionpack/test/template/test_test.rb
@@ -41,6 +41,7 @@ class PeopleHelperTest < ActionView::TestCase
def test_link_to_person
person = mock(:name => "David")
+ person.class.extend ActiveModel::Naming
expects(:mocha_mock_path).with(person).returns("/people/1")
assert_equal '<a href="/people/1">David</a>', link_to_person(person)
end
diff --git a/actionpack/test/template/url_helper_test.rb b/actionpack/test/template/url_helper_test.rb
index f3d2f87b4a..f0364fd660 100644
--- a/actionpack/test/template/url_helper_test.rb
+++ b/actionpack/test/template/url_helper_test.rb
@@ -494,6 +494,7 @@ class LinkToUnlessCurrentWithControllerTest < ActionView::TestCase
end
class Workshop
+ extend ActiveModel::Naming
attr_accessor :id, :new_record
def initialize(id, new_record)
@@ -510,6 +511,7 @@ class Workshop
end
class Session
+ extend ActiveModel::Naming
attr_accessor :id, :workshop_id, :new_record
def initialize(id, new_record)