aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/test')
-rw-r--r--actionpack/test/controller/assert_select_test.rb6
-rw-r--r--actionpack/test/controller/base_test.rb14
-rw-r--r--actionpack/test/controller/dispatcher_test.rb59
-rw-r--r--actionpack/test/controller/helper_test.rb31
-rw-r--r--actionpack/test/template/capture_helper_test.rb2
-rw-r--r--actionpack/test/template/erb/tag_helper_test.rb44
-rw-r--r--actionpack/test/template/form_helper_test.rb5
-rw-r--r--actionpack/test/template/render_test.rb9
8 files changed, 47 insertions, 123 deletions
diff --git a/actionpack/test/controller/assert_select_test.rb b/actionpack/test/controller/assert_select_test.rb
index ef0df9d6a8..2600dae3c5 100644
--- a/actionpack/test/controller/assert_select_test.rb
+++ b/actionpack/test/controller/assert_select_test.rb
@@ -15,10 +15,8 @@ class AssertSelectTest < ActionController::TestCase
class AssertSelectMailer < ActionMailer::Base
def test(html)
- recipients "test <test@test.host>"
- from "test@test.host"
- subject "Test e-mail"
- part :content_type=>"text/html", :body=>html
+ mail :body => html, :content_type => "text/html",
+ :subject => "Test e-mail", :from => "test@test.host", :to => "test <test@test.host>"
end
end
diff --git a/actionpack/test/controller/base_test.rb b/actionpack/test/controller/base_test.rb
index 032c22db3b..5ec59acf8d 100644
--- a/actionpack/test/controller/base_test.rb
+++ b/actionpack/test/controller/base_test.rb
@@ -100,20 +100,6 @@ class ControllerClassTests < ActiveSupport::TestCase
assert_equal 'contained_empty', Submodule::ContainedEmptyController.controller_name
end
- def test_filter_parameter_logging
- parameters = []
- config = mock(:config => mock(:filter_parameters => parameters))
- Rails.expects(:application).returns(config)
-
- assert_deprecated do
- Class.new(ActionController::Base) do
- filter_parameter_logging :password
- end
- end
-
- assert_equal [:password], parameters
- end
-
def test_record_identifier
assert_respond_to RecordIdentifierController.new, :dom_id
assert_respond_to RecordIdentifierController.new, :dom_class
diff --git a/actionpack/test/controller/dispatcher_test.rb b/actionpack/test/controller/dispatcher_test.rb
deleted file mode 100644
index ebe089aaf4..0000000000
--- a/actionpack/test/controller/dispatcher_test.rb
+++ /dev/null
@@ -1,59 +0,0 @@
-require 'abstract_unit'
-
-# Ensure deprecated dispatcher works
-class DeprecatedDispatcherTest < ActiveSupport::TestCase
- class DummyApp
- def call(env)
- [200, {}, 'response']
- end
- end
-
- def setup
- ActionDispatch::Callbacks.reset_callbacks(:prepare)
- ActionDispatch::Callbacks.reset_callbacks(:call)
- end
-
- def test_assert_deprecated_to_prepare
- a = nil
-
- assert_deprecated do
- ActionController::Dispatcher.to_prepare { a = 1 }
- end
-
- assert_nil a
- dispatch
- assert_equal 1, a
- end
-
- def test_assert_deprecated_before_dispatch
- a = nil
-
- assert_deprecated do
- ActionController::Dispatcher.before_dispatch { a = 1 }
- end
-
- assert_nil a
- dispatch
- assert_equal 1, a
- end
-
- def test_assert_deprecated_after_dispatch
- a = nil
-
- assert_deprecated do
- ActionController::Dispatcher.after_dispatch { a = 1 }
- end
-
- assert_nil a
- dispatch
- assert_equal 1, a
- end
-
- private
-
- def dispatch(cache_classes = true)
- @dispatcher ||= ActionDispatch::Callbacks.new(DummyApp.new, !cache_classes)
- @dispatcher.call({'rack.input' => StringIO.new('')})
- end
-
-end
diff --git a/actionpack/test/controller/helper_test.rb b/actionpack/test/controller/helper_test.rb
index 4f8ff4140f..9093fa9e17 100644
--- a/actionpack/test/controller/helper_test.rb
+++ b/actionpack/test/controller/helper_test.rb
@@ -25,8 +25,27 @@ class AllHelpersController < ActionController::Base
helper :all
end
+module ImpressiveLibrary
+ extend ActiveSupport::Concern
+ included do
+ helper_method :useful_function
+ end
+
+ def useful_function() end
+end
+
+ActionController::Base.send :include, ImpressiveLibrary
+
class JustMeController < ActionController::Base
clear_helpers
+
+ def flash
+ render :inline => "<h1><%= notice %></h1>"
+ end
+
+ def lib
+ render :inline => '<%= useful_function %>'
+ end
end
class MeTooController < JustMeController
@@ -104,6 +123,18 @@ class HelperTest < ActiveSupport::TestCase
assert_equal [MeTooHelper, JustMeHelper], MeTooController._helpers.ancestors.reject(&:anonymous?)
end
+ def test_base_helper_methods_after_clear_helpers
+ assert_nothing_raised do
+ call_controller(JustMeController, "flash")
+ end
+ end
+
+ def test_lib_helper_methods_after_clear_helpers
+ assert_nothing_raised do
+ call_controller(JustMeController, "lib")
+ end
+ end
+
def test_all_helpers
methods = AllHelpersController._helpers.instance_methods.map {|m| m.to_s}
diff --git a/actionpack/test/template/capture_helper_test.rb b/actionpack/test/template/capture_helper_test.rb
index f7c42c7f22..8f81076299 100644
--- a/actionpack/test/template/capture_helper_test.rb
+++ b/actionpack/test/template/capture_helper_test.rb
@@ -15,7 +15,6 @@ class CaptureHelperTest < ActionView::TestCase
end
assert_nil @av.output_buffer
assert_equal 'foobar', string
- assert_kind_of ActionView::NonConcattingString, string
end
def test_capture_captures_the_value_returned_by_the_block_if_the_temporary_buffer_is_blank
@@ -23,7 +22,6 @@ class CaptureHelperTest < ActionView::TestCase
a + b
end
assert_equal 'foobar', string
- assert_kind_of ActionView::NonConcattingString, string
end
def test_capture_returns_nil_if_the_returned_value_is_not_a_string
diff --git a/actionpack/test/template/erb/tag_helper_test.rb b/actionpack/test/template/erb/tag_helper_test.rb
index d073100986..036f3a3cc9 100644
--- a/actionpack/test/template/erb/tag_helper_test.rb
+++ b/actionpack/test/template/erb/tag_helper_test.rb
@@ -2,59 +2,35 @@ require "abstract_unit"
require "template/erb/helper"
module ERBTest
- module SharedTagHelpers
- extend ActiveSupport::Testing::Declarative
-
- def maybe_deprecated
- if @deprecated
- assert_deprecated { yield }
- else
- yield
- end
+ class TagHelperTest < BlockTestCase
+ def block_helper(str, rest)
+ "<%= #{str} do %>#{rest}<% end %>"
end
+ extend ActiveSupport::Testing::Declarative
+
test "percent equals works for content_tag and does not require parenthesis on method call" do
- maybe_deprecated { assert_equal "<div>Hello world</div>", render_content("content_tag :div", "Hello world") }
+ assert_equal "<div>Hello world</div>", render_content("content_tag :div", "Hello world")
end
test "percent equals works for javascript_tag" do
expected_output = "<script type=\"text/javascript\">\n//<![CDATA[\nalert('Hello')\n//]]>\n</script>"
- maybe_deprecated { assert_equal expected_output, render_content("javascript_tag", "alert('Hello')") }
+ assert_equal expected_output, render_content("javascript_tag", "alert('Hello')")
end
test "percent equals works for javascript_tag with options" do
expected_output = "<script id=\"the_js_tag\" type=\"text/javascript\">\n//<![CDATA[\nalert('Hello')\n//]]>\n</script>"
- maybe_deprecated { assert_equal expected_output, render_content("javascript_tag(:id => 'the_js_tag')", "alert('Hello')") }
+ assert_equal expected_output, render_content("javascript_tag(:id => 'the_js_tag')", "alert('Hello')")
end
test "percent equals works with form tags" do
expected_output = %r{<form.*action="foo".*method="post">.*hello*</form>}
- maybe_deprecated { assert_match expected_output, render_content("form_tag('foo')", "<%= 'hello' %>") }
+ assert_match expected_output, render_content("form_tag('foo')", "<%= 'hello' %>")
end
test "percent equals works with fieldset tags" do
expected_output = "<fieldset><legend>foo</legend>hello</fieldset>"
- maybe_deprecated { assert_equal expected_output, render_content("field_set_tag('foo')", "<%= 'hello' %>") }
+ assert_equal expected_output, render_content("field_set_tag('foo')", "<%= 'hello' %>")
end
end
-
- class TagHelperTest < BlockTestCase
- def block_helper(str, rest)
- "<%= #{str} do %>#{rest}<% end %>"
- end
-
- include SharedTagHelpers
- end
-
- class DeprecatedTagHelperTest < BlockTestCase
- def block_helper(str, rest)
- "<% __in_erb_template=true %><% #{str} do %>#{rest}<% end %>"
- end
-
- def setup
- @deprecated = true
- end
-
- include SharedTagHelpers
- end
end \ No newline at end of file
diff --git a/actionpack/test/template/form_helper_test.rb b/actionpack/test/template/form_helper_test.rb
index 8ba4aa1639..fd801e2a9e 100644
--- a/actionpack/test/template/form_helper_test.rb
+++ b/actionpack/test/template/form_helper_test.rb
@@ -167,7 +167,10 @@ class FormHelperTest < ActionView::TestCase
'<input id="post_title" name="post[title]" size="30" type="text" value="Hello World" />', text_field("post", "title")
)
assert_dom_equal(
- '<input id="post_title" name="post[title]" size="30" type="password" value="Hello World" />', password_field("post", "title")
+ '<input id="post_title" name="post[title]" size="30" type="password" />', password_field("post", "title")
+ )
+ assert_dom_equal(
+ '<input id="post_title" name="post[title]" size="30" type="password" value="Hello World" />', password_field("post", "title", :value => @post.title)
)
assert_dom_equal(
'<input id="person_name" name="person[name]" size="30" type="password" />', password_field("person", "name")
diff --git a/actionpack/test/template/render_test.rb b/actionpack/test/template/render_test.rb
index 60d4d9f4a7..229766612f 100644
--- a/actionpack/test/template/render_test.rb
+++ b/actionpack/test/template/render_test.rb
@@ -234,15 +234,6 @@ module RenderTestCases
@view.render(:file => "test/hello_world.erb", :layout => "layouts/yield_with_render_inline_inside")
end
-
- # TODO: Move to deprecated_tests.rb
- def test_render_with_nested_layout_deprecated
- assert_deprecated do
- assert_equal %(<title>title</title>\n\n<div id="column">column</div>\n<div id="content">content</div>\n),
- @view.render(:file => "test/deprecated_nested_layout.erb", :layout => "layouts/yield")
- end
- end
-
def test_render_with_nested_layout
assert_equal %(<title>title</title>\n\n<div id="column">column</div>\n<div id="content">content</div>\n),
@view.render(:file => "test/nested_layout.erb", :layout => "layouts/yield")