setting_test.rb 1.41 KB
Newer Older
1
#-- encoding: UTF-8
2 3
#-- copyright
# ChiliProject is a project management system.
4
#
Holger Just's avatar
Holger Just committed
5
# Copyright (C) 2010-2013 the ChiliProject Team
6
#
7 8 9 10
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
11
#
12 13
# See doc/COPYRIGHT.rdoc for more details.
#++
14
require File.expand_path('../../test_helper', __FILE__)
15

16
class SettingTest < ActiveSupport::TestCase
17

18
  def test_read_default
19
    assert_equal "ChiliProject", Setting.app_title
20 21 22
    assert Setting.self_registration?
    assert !Setting.login_required?
  end
23

24 25 26 27 28
  def test_update
    Setting.app_title = "My title"
    assert_equal "My title", Setting.app_title
    # make sure db has been updated (INSERT)
    assert_equal "My title", Setting.find_by_name('app_title').value
29

30 31 32 33 34
    Setting.app_title = "My other title"
    assert_equal "My other title", Setting.app_title
    # make sure db has been updated (UPDATE)
    assert_equal "My other title", Setting.find_by_name('app_title').value
  end
35

36
  def test_serialized_setting
37
    Setting.notified_events = ['issue_added', 'issue_updated', 'news_added']
38 39 40
    assert_equal ['issue_added', 'issue_updated', 'news_added'], Setting.notified_events
    assert_equal ['issue_added', 'issue_updated', 'news_added'], Setting.find_by_name('notified_events').value
  end
41
end