Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Deprecation removed build fixed #11274

Merged
merged 1 commit into from

5 participants

@arunagw
Collaborator

No description provided.

...record/test/cases/migration/column_attributes_test.rb
@@ -177,7 +177,7 @@ def test_native_types
with_env_tz 'US/Eastern' do
bob.reload
- assert_equal DateTime.local_offset, bob.moment_of_truth.offset
+ assert_equal DateTime.civil_from_format(:local, 2012), bob.moment_of_truth.offset
@arunagw Collaborator
arunagw added a note

I am not sure about this test. Might fail on oracle but we need to place something as local_offset is removed.

I will test this using oracle adaptor.

Or may be @yahonda want's to have a look

@pixeltrix any comment here? :)

@pixeltrix Owner

If you look a couple of lines above there's this:

# Test DateTime column and defaults, including timezone.
# FIXME: moment of truth may be Time on 64-bit platforms.
if bob.moment_of_truth.is_a?(DateTime)

Which dates back to db69c9c when we used to fallback to using DateTime when the range of valid Time values was limited. This is no longer the case for Rails 4.0+ - it should always be a Time so I doubt even if this block of code is being tested.

In fact If it is returning a DateTime, I'd consider that a bug :smile:

@yahonda
yahonda added a note

Just cherry-pick f51ddc39637bc259bf4293a9c90622fe63f39e3c to master and tested with Oracle enhanced adapter, it passes successfully.

$ ARCONN=oracle ruby -Itest test/cases/migration/column_attributes_test.rb -n test_native_types
Using oracle
Run options: -n test_native_types --seed 31832

# Running:

.

Finished in 0.215049s, 4.6501 runs/s, 65.1015 assertions/s.

1 runs, 14 assertions, 0 failures, 0 errors, 0 skips
$
@pixeltrix Owner

@yahonda look at the assertion count - it's 14 which means that the changes in f51dd3 aren't tested otherwise the assertion count would be 20.

@arunagw the block of code is scoped with unless current_adapter?(:OracleAdapter) so it never runs on Oracle anyway.

@arunagw Collaborator
arunagw added a note

Ahh true. It's unless thanks @pixeltrix

I wil check back this PR and update accordingly.

@arunagw Collaborator
arunagw added a note

I just checked and found that this code is not being called.

Do we need to update this test? or just simply remove this block of code?

Because there is no method called .offset

@rafaelfranca Owner

It is safer to remove in my opinion

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
activesupport/test/core_ext/module_test.rb
@@ -278,12 +278,6 @@ def test_parents
def test_local_constants
assert_equal %w(Constant1 Constant3), Ab.local_constants.sort.map(&:to_s)
end
-
- def test_local_constant_names
@arunagw Collaborator
arunagw added a note

This is fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@arunagw
Collaborator

PR updated.

thanks.

@rafaelfranca rafaelfranca merged commit 7d384dd into from
@arunagw arunagw deleted the branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jul 7, 2013
  1. @arunagw

    Removed unused test for DateTime.local_offset

    arunagw authored
    see discussion here #11274
This page is out of date. Refresh to see the latest.
Showing with 0 additions and 20 deletions.
  1. +0 −20 activerecord/test/cases/migration/column_attributes_test.rb
View
20 activerecord/test/cases/migration/column_attributes_test.rb
@@ -168,26 +168,6 @@ def test_native_types
assert_equal Date, bob.favorite_day.class
end
- # Oracle adapter stores Time or DateTime with timezone value already in _before_type_cast column
- # therefore no timezone change is done afterwards when default timezone is changed
- unless current_adapter?(:OracleAdapter)
- # Test DateTime column and defaults, including timezone.
- # FIXME: moment of truth may be Time on 64-bit platforms.
- if bob.moment_of_truth.is_a?(DateTime)
-
- with_env_tz 'US/Eastern' do
- bob.reload
- assert_equal DateTime.local_offset, bob.moment_of_truth.offset
- assert_not_equal 0, bob.moment_of_truth.offset
- assert_not_equal "Z", bob.moment_of_truth.zone
- # US/Eastern is -5 hours from GMT
- assert_equal Rational(-5, 24), bob.moment_of_truth.offset
- assert_match(/\A-05:00\Z/, bob.moment_of_truth.zone)
- assert_equal DateTime::ITALY, bob.moment_of_truth.start
- end
- end
- end
-
assert_instance_of TrueClass, bob.male?
assert_kind_of BigDecimal, bob.wealth
end
Something went wrong with that request. Please try again.