Skip to content

Commit

Permalink
Fix for running tests in non-Australian timezones
Browse files Browse the repository at this point in the history
  • Loading branch information
jarl-dk committed Apr 30, 2013
1 parent dd3b6b5 commit 0d2c7ce
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ class PersonWithShim < Person
include TestModelShim
end

ActiveRecord::Base.default_timezone = :utc
ActiveRecord::Base.time_zone_aware_attributes = true
ActiveRecord::Base.establish_connection({:adapter => 'sqlite3', :database => ':memory:'})
ActiveRecord::Migration.verbose = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

it 'should assign a Time value for valid datetimes' do
employee = record_with_multiparameter_attribute(:birth_datetime, [2000, 2, 28, 12, 0, 0])
employee.birth_datetime_before_type_cast.should eq Time.local(2000, 2, 28, 12, 0, 0)
employee.birth_datetime_before_type_cast.should eq Time.zone.local(2000, 2, 28, 12, 0, 0)
end

it 'should assign a string value for incomplete time' do
Expand Down
2 changes: 1 addition & 1 deletion spec/validates_timeliness/orm/active_record_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ class EmployeeWithParser < ActiveRecord::Base
Employee.create(:birth_datetime => datetime)

record = Employee.last
record.birth_datetime_before_type_cast.should match(/2010-01-01 00:00:00/)
record.birth_datetime_before_type_cast.should match(/#{datetime.utc.to_s[0...-4]}/)
end

context "with plugin parser" do
Expand Down

0 comments on commit 0d2c7ce

Please sign in to comment.