if new_record? && !(attributes && attributes.key?(:hide_mail))
self.hide_mail = Setting.default_users_hide_mail?
end
+ if new_record? && !(attributes && attributes.key?(:no_self_notified))
+ self.no_self_notified = true
+ end
self.others ||= {}
end
user_preferences_001:
others: |
---
+ :no_self_notified: false
:my_page_layout:
left:
- latestnews
user_preferences_002:
others: |
---
+ :no_self_notified: false
+
+ id: 2
+ user_id: 2
+ hide_mail: true
+user_preferences_003:
+ others: |
+ ---
+ :no_self_notified: false
:my_page_layout:
left:
- latestnews
top:
- calendar
- id: 2
+ id: 3
user_id: 3
hide_mail: false
class IssuesControllerTest < ActionController::TestCase
fixtures :projects,
- :users, :email_addresses,
+ :users, :email_addresses, :user_preferences,
:roles,
:members,
:member_roles,
class IssuesCustomFieldsVisibilityTest < ActionController::TestCase
tests IssuesController
fixtures :projects,
- :users, :email_addresses,
+ :users, :email_addresses, :user_preferences,
:roles,
:members,
:member_roles,
require File.expand_path('../../test_helper', __FILE__)
class MessagesControllerTest < ActionController::TestCase
- fixtures :projects, :users, :email_addresses, :members, :member_roles, :roles, :boards, :messages, :enabled_modules
+ fixtures :projects, :users, :email_addresses, :user_preferences, :members, :member_roles, :roles, :boards, :messages, :enabled_modules
def setup
User.current = nil
require File.expand_path('../../test_helper', __FILE__)
class IssueTest < ActiveSupport::TestCase
- fixtures :projects, :users, :email_addresses, :members, :member_roles, :roles,
+ fixtures :projects, :users, :email_addresses, :user_preferences, :members, :member_roles, :roles,
:groups_users,
:trackers, :projects_trackers,
:enabled_modules,
class MailHandlerTest < ActiveSupport::TestCase
fixtures :users, :projects, :enabled_modules, :roles,
:members, :member_roles, :users,
- :email_addresses,
+ :email_addresses, :user_preferences,
:issues, :issue_statuses,
:workflows, :trackers, :projects_trackers,
:versions, :enumerations, :issue_categories,
end
end
+ def test_no_self_notified_should_default_to_true
+ preference = UserPreference.new
+ assert_equal true, preference.no_self_notified
+ end
+
def test_create
user = User.new(:firstname => "new", :lastname => "user", :mail => "newuser@somenet.foo")
user.login = "newuser"
assert_kind_of Hash, up.others
end
- def test_others_should_be_blank_after_initialization
- pref = User.new.pref
- assert_equal({}, pref.others)
- end
-
def test_reading_value_from_nil_others_hash
up = UserPreference.new(:user => User.new)
up.others = nil