summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--db/migrate/20151021190616_change_user_preferences_hide_mail_default_to_true.rb9
-rw-r--r--test/unit/user_preference_test.rb5
2 files changed, 14 insertions, 0 deletions
diff --git a/db/migrate/20151021190616_change_user_preferences_hide_mail_default_to_true.rb b/db/migrate/20151021190616_change_user_preferences_hide_mail_default_to_true.rb
new file mode 100644
index 000000000..fc5d268a6
--- /dev/null
+++ b/db/migrate/20151021190616_change_user_preferences_hide_mail_default_to_true.rb
@@ -0,0 +1,9 @@
+class ChangeUserPreferencesHideMailDefaultToTrue < ActiveRecord::Migration
+ def self.up
+ change_column :user_preferences, :hide_mail, :boolean, :default => true
+ end
+
+ def self.down
+ change_column :user_preferences, :hide_mail, :boolean, :default => false
+ end
+end
diff --git a/test/unit/user_preference_test.rb b/test/unit/user_preference_test.rb
index ee5cb65d4..c76862408 100644
--- a/test/unit/user_preference_test.rb
+++ b/test/unit/user_preference_test.rb
@@ -20,6 +20,11 @@ require File.expand_path('../../test_helper', __FILE__)
class UserPreferenceTest < ActiveSupport::TestCase
fixtures :users, :user_preferences
+ def test_hide_mail_should_default_to_true
+ preference = UserPreference.new
+ assert_equal true, preference.hide_mail
+ end
+
def test_create
user = User.new(:firstname => "new", :lastname => "user", :mail => "newuser@somenet.foo")
user.login = "newuser"