diff options
author | Pratik Naik <pratiknaik@gmail.com> | 2008-05-27 12:24:46 +0100 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2008-05-27 12:24:46 +0100 |
commit | f8b402c5d81c7baedae9a27eebf83aa947698cc0 (patch) | |
tree | f3012914003ee63ce34abf498b5015a875273b63 | |
parent | 9d9c96af56986b84a732aa609569b5035825f5f8 (diff) | |
parent | 888a2927b65889465ce7a1a71e87d37640a2b41b (diff) | |
download | rails-f8b402c5d81c7baedae9a27eebf83aa947698cc0.tar.gz rails-f8b402c5d81c7baedae9a27eebf83aa947698cc0.tar.bz2 rails-f8b402c5d81c7baedae9a27eebf83aa947698cc0.zip |
Merge commit 'mainstream/master'
-rw-r--r-- | actionpack/lib/action_view/test_case.rb | 14 | ||||
-rw-r--r-- | actionpack/test/template/prototype_helper_test.rb | 2 | ||||
-rw-r--r-- | activerecord/test/cases/datatype_test_postgresql.rb | 8 | ||||
-rw-r--r-- | activerecord/test/cases/finder_test.rb | 2 | ||||
-rw-r--r-- | activesupport/CHANGELOG | 2 | ||||
-rw-r--r-- | activesupport/lib/active_support/values/time_zone.rb | 2 | ||||
-rw-r--r-- | activesupport/test/time_zone_test.rb | 2 |
7 files changed, 13 insertions, 19 deletions
diff --git a/actionpack/lib/action_view/test_case.rb b/actionpack/lib/action_view/test_case.rb index b2e6589d81..16fedd9732 100644 --- a/actionpack/lib/action_view/test_case.rb +++ b/actionpack/lib/action_view/test_case.rb @@ -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 @@ module ActionView def determine_default_helper_class(name) name.sub(/Test$/, '').constantize rescue NameError - raise NonInferrableHelperError.new(name) + nil end end @@ -42,7 +34,9 @@ module ActionView 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 diff --git a/actionpack/test/template/prototype_helper_test.rb b/actionpack/test/template/prototype_helper_test.rb index 5e00eadb8d..53a250f9d5 100644 --- a/actionpack/test/template/prototype_helper_test.rb +++ b/actionpack/test/template/prototype_helper_test.rb @@ -25,8 +25,6 @@ class Author::Nested < Author; end class PrototypeHelperBaseTest < ActionView::TestCase - tests ActionView::Helpers::PrototypeHelper - attr_accessor :template_format def setup diff --git a/activerecord/test/cases/datatype_test_postgresql.rb b/activerecord/test/cases/datatype_test_postgresql.rb index 41726ce518..bff092b5d7 100644 --- a/activerecord/test/cases/datatype_test_postgresql.rb +++ b/activerecord/test/cases/datatype_test_postgresql.rb @@ -30,8 +30,8 @@ class PostgresqlDataTypeTest < ActiveRecord::TestCase @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 @@ class PostgresqlDataTypeTest < ActiveRecord::TestCase 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 diff --git a/activerecord/test/cases/finder_test.rb b/activerecord/test/cases/finder_test.rb index 5c0f0e2ef1..80936d51f3 100644 --- a/activerecord/test/cases/finder_test.rb +++ b/activerecord/test/cases/finder_test.rb @@ -867,7 +867,7 @@ class FinderTest < ActiveRecord::TestCase 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 diff --git a/activesupport/CHANGELOG b/activesupport/CHANGELOG index 6250f33998..7e408840c4 100644 --- a/activesupport/CHANGELOG +++ b/activesupport/CHANGELOG @@ -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] diff --git a/activesupport/lib/active_support/values/time_zone.rb b/activesupport/lib/active_support/values/time_zone.rb index 4d7239d8cf..a71c819fba 100644 --- a/activesupport/lib/active_support/values/time_zone.rb +++ b/activesupport/lib/active_support/values/time_zone.rb @@ -202,7 +202,7 @@ class TimeZone # 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: diff --git a/activesupport/test/time_zone_test.rb b/activesupport/test/time_zone_test.rb index 3757ddcedb..f3069b589b 100644 --- a/activesupport/test/time_zone_test.rb +++ b/activesupport/test/time_zone_test.rb @@ -252,7 +252,7 @@ class TimeZoneTest < Test::Unit::TestCase 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 |