Merge branch 'timezones' of git://github.com/epall/tracks into master.

Re-wrote all Date-related code to use Datetimes, created a migration to get rid of all date columns in the database, and got rid of Time.now calls that were not time zone-aware. Lots of time zone goodness!
This commit is contained in:
Eric Allen 2008-09-21 18:22:48 -07:00
commit ba9a9370cc
21 changed files with 111 additions and 78 deletions

View file

@ -10,7 +10,7 @@ describe Todo do
def create_todo(attributes={})
todo = Todo.new(valid_attributes(attributes))
todo.stub!(:user).and_return(mock_model(User, :date => Time.now))
todo.stub!(:user).and_return(mock_model(User, :date => Time.zone.now))
todo.save!
todo
end
@ -32,7 +32,7 @@ describe Todo do
it 'ensures that show_from is a date in the future' do
todo = Todo.new(valid_attributes)
todo.stub!(:user).and_return(mock_model(User, :date => Time.now))
todo.stub!(:user).and_return(mock_model(User, :date => Time.zone.now))
todo.show_from = 3.days.ago
todo.should have(1).error_on(:show_from)
end

View file

@ -185,8 +185,9 @@ describe User do
user.save!
user.create_preference
user.preference.update_attribute('time_zone', 'Pacific Time (US & Canada)')
# Time.zone = 'Pacific Time (US & Canada)'
Time.stub!(:now).and_return(Time.new.end_of_day - 20.minutes)
todo = user.todos.build(:description => 'test task', :context => context, :show_from => user.date + 1)
todo = user.todos.build(:description => 'test task', :context => context, :show_from => user.date + 1.days)
todo.save!
user.deferred_todos.find_and_activate_ready