Permalink
Browse files

Merge commit 'mainstream/master'

  • Loading branch information...
2 parents 9d9c96a + 888a292 commit f8b402c5d81c7baedae9a27eebf83aa947698cc0 @lifo lifo committed May 27, 2008
@@ -1,14 +1,6 @@
require 'active_support/test_case'
module ActionView
- class NonInferrableHelperError < ActionViewError
- def initialize(name)
- super "Unable to determine the helper to test from #{name}. " +
- "You'll need to specify it using tests YourHelper in your " +
- "test case definition"
- end
- end
-
class TestCase < ActiveSupport::TestCase
class_inheritable_accessor :helper_class
@@helper_class = nil
@@ -29,7 +21,7 @@ def helper_class
def determine_default_helper_class(name)
name.sub(/Test$/, '').constantize
rescue NameError
- raise NonInferrableHelperError.new(name)
+ nil
end
end
@@ -42,7 +34,9 @@ def determine_default_helper_class(name)
setup :setup_with_helper_class
def setup_with_helper_class
- self.class.send(:include, helper_class)
+ if helper_class && !self.class.ancestors.include?(helper_class)
+ self.class.send(:include, helper_class)
+ end
end
class TestController < ActionController::Base
@@ -25,8 +25,6 @@ class Author::Nested < Author; end
class PrototypeHelperBaseTest < ActionView::TestCase
- tests ActionView::Helpers::PrototypeHelper
-
attr_accessor :template_format
def setup
@@ -30,8 +30,8 @@ def setup
@connection.execute("INSERT INTO postgresql_arrays (commission_by_quarter, nicknames) VALUES ( '{35000,21000,18000,17000}', '{foo,bar,baz}' )")
@first_array = PostgresqlArray.find(1)
- @connection.execute("INSERT INTO postgresql_moneys (wealth) VALUES ('$567.89')")
- @connection.execute("INSERT INTO postgresql_moneys (wealth) VALUES ('-$567.89')")
+ @connection.execute("INSERT INTO postgresql_moneys (wealth) VALUES ('567.89'::money)")
+ @connection.execute("INSERT INTO postgresql_moneys (wealth) VALUES ('-567.89'::money)")
@first_money = PostgresqlMoney.find(1)
@second_money = PostgresqlMoney.find(2)
@@ -143,11 +143,11 @@ def test_update_text_array
end
def test_update_money
- new_value = 123.45
+ new_value = BigDecimal.new('123.45')
assert @first_money.wealth = new_value
assert @first_money.save
assert @first_money.reload
- assert_equal @first_money.wealth, new_value
+ assert_equal new_value, @first_money.wealth
end
def test_update_number
@@ -867,7 +867,7 @@ def test_find_with_order_on_included_associations_with_construct_finder_sql_for_
end
def test_with_limiting_with_custom_select
- posts = Post.find(:all, :include => :author, :select => ' posts.*, authors.id as "author_id"', :limit => 3)
+ posts = Post.find(:all, :include => :author, :select => ' posts.*, authors.id as "author_id"', :limit => 3, :order => 'posts.id')
assert_equal 3, posts.size
assert_equal [0, 1, 1], posts.map(&:author_id).sort
end
View
@@ -1,3 +1,5 @@
+* TimeZone#to_s shows offset as GMT instead of UTC, because GMT will be more familiar to end users (see time zone selects used by Windows OS, google.com and yahoo.com.) Reverts [8370] [Geoff Buesing]
+
* Hash.from_xml: datetime xml types overflow to Ruby DateTime class when out of range of Time. Adding tests for utc offsets [Geoff Buesing]
* TimeWithZone #+ and #- : ensure overflow to DateTime with Numeric arg [Geoff Buesing]
@@ -202,7 +202,7 @@ def <=>(zone)
# Returns a textual representation of this time zone.
def to_s
- "(UTC#{formatted_offset}) #{name}"
+ "(GMT#{formatted_offset}) #{name}"
end
# Method for creating new ActiveSupport::TimeWithZone instance in time zone of +self+ from given values. Example:
@@ -252,7 +252,7 @@ def test_zone_compare
end
def test_to_s
- assert_equal "(UTC+03:00) Moscow", TimeZone['Moscow'].to_s
+ assert_equal "(GMT+03:00) Moscow", TimeZone['Moscow'].to_s
end
def test_all_sorted

0 comments on commit f8b402c

Please sign in to comment.