Upgrade to Rails 2.2.0

As a side benefit, fix an (non-user-visible) bug in display_s5().
Also fixed a bug where removing orphaned pages did not expire cached summary pages.
This commit is contained in:
Jacques Distler 2008-10-27 01:47:01 -05:00
parent 39348c65c2
commit 7600aef48b
827 changed files with 123652 additions and 11027 deletions

View file

@ -17,6 +17,8 @@ unless defined?(ActionMailer)
end
end
ActionMailer::Base.template_root = FIXTURE_LOAD_PATH
class AssertSelectTest < Test::Unit::TestCase
class AssertSelectController < ActionController::Base
def response_with=(content)
@ -69,11 +71,10 @@ class AssertSelectTest < Test::Unit::TestCase
ActionMailer::Base.deliveries = []
end
def teardown
ActionMailer::Base.deliveries.clear
end
def assert_failure(message, &block)
e = assert_raises(AssertionFailedError, &block)
assert_match(message, e.message) if Regexp === message
@ -91,7 +92,6 @@ class AssertSelectTest < Test::Unit::TestCase
assert_failure(/Expected at least 1 element matching \"p\", found 0/) { assert_select "p" }
end
def test_equality_true_false
render_html %Q{<div id="1"></div><div id="2"></div>}
assert_nothing_raised { assert_select "div" }
@ -102,7 +102,6 @@ class AssertSelectTest < Test::Unit::TestCase
assert_nothing_raised { assert_select "p", false }
end
def test_equality_string_and_regexp
render_html %Q{<div id="1">foo</div><div id="2">foo</div>}
assert_nothing_raised { assert_select "div", "foo" }
@ -116,7 +115,6 @@ class AssertSelectTest < Test::Unit::TestCase
assert_raises(AssertionFailedError) { assert_select "p", :text=>/foobar/ }
end
def test_equality_of_html
render_html %Q{<p>\n<em>"This is <strong>not</strong> a big problem,"</em> he said.\n</p>}
text = "\"This is not a big problem,\" he said."
@ -135,7 +133,6 @@ class AssertSelectTest < Test::Unit::TestCase
assert_raises(AssertionFailedError) { assert_select "pre", :html=>text }
end
def test_counts
render_html %Q{<div id="1">foo</div><div id="2">foo</div>}
assert_nothing_raised { assert_select "div", 2 }
@ -166,7 +163,6 @@ class AssertSelectTest < Test::Unit::TestCase
end
end
def test_substitution_values
render_html %Q{<div id="1">foo</div><div id="2">foo</div>}
assert_select "div#?", /\d+/ do |elements|
@ -181,7 +177,6 @@ class AssertSelectTest < Test::Unit::TestCase
end
end
def test_nested_assert_select
render_html %Q{<div id="1">foo</div><div id="2">foo</div>}
assert_select "div" do |elements|
@ -200,7 +195,7 @@ class AssertSelectTest < Test::Unit::TestCase
assert_select "#3", false
end
end
assert_failure(/Expected at least 1 element matching \"#4\", found 0\./) do
assert_select "div" do
assert_select "#4"
@ -208,7 +203,6 @@ class AssertSelectTest < Test::Unit::TestCase
end
end
def test_assert_select_text_match
render_html %Q{<div id="1"><span>foo</span></div><div id="2"><span>bar</span></div>}
assert_select "div" do
@ -225,7 +219,6 @@ class AssertSelectTest < Test::Unit::TestCase
end
end
# With single result.
def test_assert_select_from_rjs_with_single_result
render_rjs do |page|
@ -255,19 +248,16 @@ class AssertSelectTest < Test::Unit::TestCase
end
end
#
# Test css_select.
#
def test_css_select
render_html %Q{<div id="1"></div><div id="2"></div>}
assert 2, css_select("div").size
assert 0, css_select("p").size
end
def test_nested_css_select
render_html %Q{<div id="1">foo</div><div id="2">foo</div>}
assert_select "div#?", /\d+/ do |elements|
@ -286,7 +276,6 @@ class AssertSelectTest < Test::Unit::TestCase
end
end
# With one result.
def test_css_select_from_rjs_with_single_result
render_rjs do |page|
@ -309,12 +298,10 @@ class AssertSelectTest < Test::Unit::TestCase
assert_equal 1, css_select("#2").size
end
#
# Test assert_select_rjs.
#
# Test that we can pick up all statements in the result.
def test_assert_select_rjs_picks_up_all_statements
render_rjs do |page|
@ -381,7 +368,6 @@ class AssertSelectTest < Test::Unit::TestCase
assert_raises(AssertionFailedError) { assert_select_rjs "test4" }
end
def test_assert_select_rjs_for_replace
render_rjs do |page|
page.replace "test1", "<div id=\"1\">foo</div>"
@ -447,6 +433,17 @@ class AssertSelectTest < Test::Unit::TestCase
assert_select_rjs :remove, "test1"
end
def test_assert_select_rjs_for_remove_offers_useful_error_when_assertion_fails
render_rjs do |page|
page.remove "test_with_typo"
end
assert_select_rjs :remove, "test1"
rescue Test::Unit::AssertionFailedError
assert_equal "No RJS statement that removes 'test1' was rendered.", $!.message
end
def test_assert_select_rjs_for_remove_ignores_block
render_rjs do |page|
page.remove "test1"
@ -468,6 +465,17 @@ class AssertSelectTest < Test::Unit::TestCase
assert_select_rjs :show, "test1"
end
def test_assert_select_rjs_for_show_offers_useful_error_when_assertion_fails
render_rjs do |page|
page.show "test_with_typo"
end
assert_select_rjs :show, "test1"
rescue Test::Unit::AssertionFailedError
assert_equal "No RJS statement that shows 'test1' was rendered.", $!.message
end
def test_assert_select_rjs_for_show_ignores_block
render_rjs do |page|
page.show "test1"
@ -479,7 +487,7 @@ class AssertSelectTest < Test::Unit::TestCase
end
end
end
# Simple hide
def test_assert_select_rjs_for_hide
render_rjs do |page|
@ -489,6 +497,17 @@ class AssertSelectTest < Test::Unit::TestCase
assert_select_rjs :hide, "test1"
end
def test_assert_select_rjs_for_hide_offers_useful_error_when_assertion_fails
render_rjs do |page|
page.hide "test_with_typo"
end
assert_select_rjs :hide, "test1"
rescue Test::Unit::AssertionFailedError
assert_equal "No RJS statement that hides 'test1' was rendered.", $!.message
end
def test_assert_select_rjs_for_hide_ignores_block
render_rjs do |page|
page.hide "test1"
@ -500,7 +519,7 @@ class AssertSelectTest < Test::Unit::TestCase
end
end
end
# Simple toggle
def test_assert_select_rjs_for_toggle
render_rjs do |page|
@ -510,6 +529,17 @@ class AssertSelectTest < Test::Unit::TestCase
assert_select_rjs :toggle, "test1"
end
def test_assert_select_rjs_for_toggle_offers_useful_error_when_assertion_fails
render_rjs do |page|
page.toggle "test_with_typo"
end
assert_select_rjs :toggle, "test1"
rescue Test::Unit::AssertionFailedError
assert_equal "No RJS statement that toggles 'test1' was rendered.", $!.message
end
def test_assert_select_rjs_for_toggle_ignores_block
render_rjs do |page|
page.toggle "test1"
@ -521,7 +551,7 @@ class AssertSelectTest < Test::Unit::TestCase
end
end
end
# Non-positioned insert.
def test_assert_select_rjs_for_nonpositioned_insert
render_rjs do |page|
@ -605,7 +635,6 @@ class AssertSelectTest < Test::Unit::TestCase
end
end
def test_feed_item_encoded
render_xml <<-EOF
<rss version="2.0">
@ -659,7 +688,6 @@ EOF
end
end
#
# Test assert_select_email
#
@ -675,7 +703,6 @@ EOF
end
end
protected
def render_html(html)
@controller.response_with = html