mirror of
https://github.com/TracksApp/tracks.git
synced 2025-09-22 05:50:47 +02:00
Fix #1722
This commit is contained in:
parent
31217762a0
commit
d7fbcb10c4
7 changed files with 10 additions and 7 deletions
|
@ -28,7 +28,7 @@ class PreferencesController < ApplicationController
|
|||
|
||||
def render_date_format
|
||||
format = params[:date_format]
|
||||
render :text => l(Date.today, :format => format)
|
||||
render :text => l(Date.current, :format => format)
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -22,7 +22,7 @@ module Tracksapp
|
|||
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
||||
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
||||
# config.time_zone = 'Central Time (US & Canada)'
|
||||
config.time_zone = SITE_CONFIG['time_zone']
|
||||
config.time_zone = SITE_CONFIG['time_zone']
|
||||
|
||||
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
||||
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
||||
|
|
|
@ -17,11 +17,11 @@ class PreferencesControllerTest < ActionController::TestCase
|
|||
|
||||
get :render_date_format
|
||||
assert_response :success
|
||||
assert_equal I18n.l(Date.today, :format => "%Y-%m-%d"), @response.body
|
||||
assert_equal I18n.l(Date.current, :format => "%Y-%m-%d"), @response.body
|
||||
|
||||
get(:render_date_format, {:date_format => "%A %Y"})
|
||||
assert_response :success
|
||||
assert_equal I18n.l(Date.today, :format => "%A %Y"), @response.body
|
||||
assert_equal I18n.l(Date.current, :format => "%A %Y"), @response.body
|
||||
end
|
||||
|
||||
test "index page requires login" do
|
||||
|
|
2
test/fixtures/todos.yml
vendored
2
test/fixtures/todos.yml
vendored
|
@ -1,6 +1,8 @@
|
|||
# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
|
||||
<%
|
||||
|
||||
Time.zone = SITE_CONFIG['time_zone']
|
||||
|
||||
def today
|
||||
Time.zone.now.beginning_of_day.to_s(:db)
|
||||
end
|
||||
|
|
|
@ -53,7 +53,7 @@ module RecurringTodos
|
|||
assert_equal_dmy @today, due_date
|
||||
|
||||
# when the last todo was completed today, the next todo is due tomorrow
|
||||
due_date =@every_day.get_due_date(@today)
|
||||
due_date = @every_day.get_due_date(@today)
|
||||
assert_equal @tomorrow, due_date
|
||||
|
||||
# do something every 14 days
|
||||
|
|
|
@ -208,7 +208,7 @@ class UserTest < ActiveSupport::TestCase
|
|||
def test_find_and_activate_deferred_todos_that_are_ready
|
||||
assert_equal 1, @admin_user.deferred_todos.count
|
||||
@admin_user.deferred_todos[0].show_from = Time.now.utc - 5.seconds
|
||||
@admin_user.deferred_todos[0].save
|
||||
@admin_user.deferred_todos[0].save(:validate => false)
|
||||
@admin_user.deferred_todos.reload
|
||||
@admin_user.deferred_todos.find_and_activate_ready
|
||||
@admin_user.deferred_todos.reload
|
||||
|
|
|
@ -13,7 +13,8 @@ class ActiveSupport::TestCase
|
|||
fixtures :all
|
||||
|
||||
def setup
|
||||
@today = Time.now.utc
|
||||
Time.zone = SITE_CONFIG['time_zone']
|
||||
@today = Time.zone.now
|
||||
@tomorrow = @today + 1.day
|
||||
@in_three_days = @today + 3.days
|
||||
@in_four_days = @in_three_days + 1.day # need a day after start_from
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue