提交 83b02041 编写于 作者: J Jeremy Kemper

Ruby 1.9 compat. References #1689 [Pratik Naik]


git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8363 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
上级 73673256
......@@ -25,7 +25,7 @@ def test_simple_reader_declaration
# The class and instance should have an accessor, but there
# should be no mutator
assert single_class.respond_to?(:only_reader)
assert single_class.public_instance_methods.include?("only_reader")
assert single_class.public_instance_methods.map(&:to_s).include?("only_reader")
assert !single_class.respond_to?(:only_reader=)
end
......@@ -45,8 +45,8 @@ def test_simple_accessor_declaration
# the instance should have an accessor only
assert single_class.respond_to?(:both)
assert single_class.respond_to?(:both=)
assert single_class.public_instance_methods.include?("both")
assert !single_class.public_instance_methods.include?("both=")
assert single_class.public_instance_methods.map(&:to_s).include?("both")
assert !single_class.public_instance_methods.map(&:to_s).include?("both=")
end
def test_working_with_simple_attributes
......
......@@ -37,7 +37,7 @@ def test_sums
end
def test_nil_sums
expected_raise = RUBY_VERSION < '1.9.0' ? TypeError : NoMethodError
expected_raise = TypeError
assert_raise(expected_raise) { [5, 15, nil].sum }
......
......@@ -4,7 +4,11 @@ class OrderedHashTest < Test::Unit::TestCase
def setup
@keys = %w( blue green red pink orange )
@values = %w( 000099 009900 aa0000 cc0066 cc6633 )
@ordered_hash = ActiveSupport::OrderedHash.new(@keys.zip(@values).to_a)
@ordered_hash = ActiveSupport::OrderedHash.new
@keys.each_with_index do |key, index|
@ordered_hash[key] = @values[index]
end
end
def test_order
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册