public
Description: El Dorado is a full-stack community web application written in Ruby/Rails.
Homepage: http://almosteffortless.com/eldorado/
Clone URL: git://github.com/trevorturk/el-dorado.git
moving time zone default from db into setting model
trevorturk (author)
Mon Jun 02 20:55:06 -0700 2008
commit  702b060f2ea76277e43920893b5251eed383f402
tree    1b50c617881683932ebf1d5213c8442ee1a72735
parent  b0b2dd822672d77c5dec02b28f0edb923fc2f294
...
6
7
8
 
9
10
11
12
13
14
15
 
16
17
18
...
6
7
8
9
10
11
12
13
14
15
 
16
17
18
19
0
@@ -6,13 +6,14 @@ class Setting < ActiveRecord::Base
0
   TAGLINE = 'A full-stack community web application written in Ruby/Rails'
0
   FOOTER = '<p style="text-align:right;margin:0;">Powered by <a href="http://almosteffortless.com/eldorado/">El Dorado</a></p>'
0
   LOGIN_MESSAGE = 'You are not logged in'
0
+ TIME_ZONE = 'UTC'
0
   
0
   def theme
0
     read_attribute(:theme) # TODO not sure why this is needed, but tests are failing without it
0
   end
0
   
0
   def self.defaults
0
- Setting.new(:title => TITLE, :tagline => TAGLINE, :footer => FOOTER, :login_message => LOGIN_MESSAGE).save
0
+ Setting.new(:title => TITLE, :tagline => TAGLINE, :footer => FOOTER, :login_message => LOGIN_MESSAGE, :time_zone => TIME_ZONE).save
0
   end
0
   
0
   def to_s
...
9
10
11
12
 
13
14
15
...
94
95
96
97
98
 
99
100
101
...
109
110
111
112
 
113
114
115
...
146
147
148
149
150
 
151
152
153
...
9
10
11
 
12
13
14
15
...
94
95
96
 
97
98
99
100
101
...
109
110
111
 
112
113
114
115
...
146
147
148
 
149
150
151
152
153
0
@@ -9,7 +9,7 @@
0
 #
0
 # It's strongly recommended to check this file into your version control system.
0
 
0
-ActiveRecord::Schema.define(:version => 20080526190223) do
0
+ActiveRecord::Schema.define(:version => 20080603035014) do
0
 
0
   create_table "avatars", :force => true do |t|
0
     t.integer "parent_id"
0
@@ -94,8 +94,8 @@ ActiveRecord::Schema.define(:version => 20080526190223) do
0
     t.integer "updated_by"
0
   end
0
 
0
- add_index "posts", ["topic_id", "created_at"], :name => "index_posts_on_topic_id_and_created_at"
0
   add_index "posts", ["user_id", "created_at"], :name => "index_posts_on_user_id"
0
+ add_index "posts", ["topic_id", "created_at"], :name => "index_posts_on_topic_id_and_created_at"
0
 
0
   create_table "ranks", :force => true do |t|
0
     t.string "title"
0
@@ -109,7 +109,7 @@ ActiveRecord::Schema.define(:version => 20080526190223) do
0
     t.text "footer"
0
     t.string "theme"
0
     t.string "favicon"
0
- t.string "time_zone", :default => "UTC"
0
+ t.string "time_zone"
0
     t.boolean "private", :default => false
0
     t.string "login_message"
0
   end
0
@@ -146,8 +146,8 @@ ActiveRecord::Schema.define(:version => 20080526190223) do
0
     t.integer "forum_id"
0
   end
0
 
0
- add_index "topics", ["forum_id", "sticky", "last_post_at"], :name => "index_topics_on_sticky_and_last_post_at"
0
   add_index "topics", ["forum_id", "last_post_at"], :name => "index_topics_on_forum_id_and_last_post_at"
0
+ add_index "topics", ["forum_id", "sticky", "last_post_at"], :name => "index_topics_on_sticky_and_last_post_at"
0
 
0
   create_table "uploads", :force => true do |t|
0
     t.integer "parent_id"
...
48
49
50
 
51
52
53
...
48
49
50
51
52
53
54
0
@@ -48,6 +48,7 @@ class HomeControllerTest < Test::Unit::TestCase
0
     Setting.destroy_all
0
     get :index
0
     assert_redirected_to new_user_path
0
+ assert_equal 'UTC', Setting.first.time_zone
0
   end
0
 
0
   def test_should_not_update_session_online_at
...
332
333
334
 
 
 
 
 
335
336
337
...
332
333
334
335
336
337
338
339
340
341
342
0
@@ -332,6 +332,11 @@ class UsersControllerTest < Test::Unit::TestCase
0
     assert_not_nil User.find_by_login('user1').online_at
0
   end
0
   
0
+ def test_that_user_gets_default_time_zone_values
0
+ post :create, :user => {:login => 'user1', :email => 'test1@test.com', :password => 'abc', :password_confirmation => 'abc'}
0
+ assert_equal User.find_by_login('user1').time_zone, 'US/Central'
0
+ end
0
+
0
   def test_should_get_ban_if_admin
0
     login_as :Administrator
0
     get :ban, :id => users(:trevor).id

Comments

    No one has commented yet.