@@ -0,0 +1,49 | |||
|
1 | # redMine - project management software | |
|
2 | # Copyright (C) 2006-2007 Jean-Philippe Lang | |
|
3 | # | |
|
4 | # This program is free software; you can redistribute it and/or | |
|
5 | # modify it under the terms of the GNU General Public License | |
|
6 | # as published by the Free Software Foundation; either version 2 | |
|
7 | # of the License, or (at your option) any later version. | |
|
8 | # | |
|
9 | # This program is distributed in the hope that it will be useful, | |
|
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
|
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
|
12 | # GNU General Public License for more details. | |
|
13 | # | |
|
14 | # You should have received a copy of the GNU General Public License | |
|
15 | # along with this program; if not, write to the Free Software | |
|
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
|
17 | ||
|
18 | require File.dirname(__FILE__) + '/../test_helper' | |
|
19 | ||
|
20 | class IssueStatusTest < Test::Unit::TestCase | |
|
21 | fixtures :issue_statuses | |
|
22 | ||
|
23 | def test_create | |
|
24 | status = IssueStatus.new :name => "Assigned" | |
|
25 | assert !status.save | |
|
26 | # status name uniqueness | |
|
27 | assert_equal 1, status.errors.count | |
|
28 | ||
|
29 | status.name = "Test Status" | |
|
30 | assert status.save | |
|
31 | assert !status.is_default | |
|
32 | end | |
|
33 | ||
|
34 | def test_default | |
|
35 | status = IssueStatus.default | |
|
36 | assert_kind_of IssueStatus, status | |
|
37 | end | |
|
38 | ||
|
39 | def test_change_default | |
|
40 | status = IssueStatus.find(2) | |
|
41 | assert !status.is_default | |
|
42 | status.is_default = true | |
|
43 | assert status.save | |
|
44 | status.reload | |
|
45 | ||
|
46 | assert_equal status, IssueStatus.default | |
|
47 | assert !IssueStatus.find(1).is_default | |
|
48 | end | |
|
49 | end |
@@ -1,5 +1,24 | |||
|
1 | # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html | |
|
2 | first: | |
|
1 | --- | |
|
2 | user_preferences_001: | |
|
3 | others: | | |
|
4 | --- | |
|
5 | :my_page_layout: | |
|
6 | left: | |
|
7 | - latest_news | |
|
8 | - documents | |
|
9 | right: | |
|
10 | - issues_assigned_to_me | |
|
11 | - issues_reported_by_me | |
|
12 | top: | |
|
13 | - calendar | |
|
14 | ||
|
3 | 15 | id: 1 |
|
4 | another: | |
|
16 | user_id: 1 | |
|
17 | hide_mail: true | |
|
18 | user_preferences_002: | |
|
19 | others: |+ | |
|
20 | --- {} | |
|
21 | ||
|
5 | 22 | id: 2 |
|
23 | user_id: 3 | |
|
24 | hide_mail: false No newline at end of file |
@@ -1,3 +1,20 | |||
|
1 | # redMine - project management software | |
|
2 | # Copyright (C) 2006-2007 Jean-Philippe Lang | |
|
3 | # | |
|
4 | # This program is free software; you can redistribute it and/or | |
|
5 | # modify it under the terms of the GNU General Public License | |
|
6 | # as published by the Free Software Foundation; either version 2 | |
|
7 | # of the License, or (at your option) any later version. | |
|
8 | # | |
|
9 | # This program is distributed in the hope that it will be useful, | |
|
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
|
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
|
12 | # GNU General Public License for more details. | |
|
13 | # | |
|
14 | # You should have received a copy of the GNU General Public License | |
|
15 | # along with this program; if not, write to the Free Software | |
|
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
|
17 | ||
|
1 | 18 | require File.dirname(__FILE__) + '/../test_helper' |
|
2 | 19 | |
|
3 | 20 | class CommentTest < Test::Unit::TestCase |
@@ -1,10 +1,29 | |||
|
1 | # redMine - project management software | |
|
2 | # Copyright (C) 2006-2007 Jean-Philippe Lang | |
|
3 | # | |
|
4 | # This program is free software; you can redistribute it and/or | |
|
5 | # modify it under the terms of the GNU General Public License | |
|
6 | # as published by the Free Software Foundation; either version 2 | |
|
7 | # of the License, or (at your option) any later version. | |
|
8 | # | |
|
9 | # This program is distributed in the hope that it will be useful, | |
|
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
|
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
|
12 | # GNU General Public License for more details. | |
|
13 | # | |
|
14 | # You should have received a copy of the GNU General Public License | |
|
15 | # along with this program; if not, write to the Free Software | |
|
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
|
17 | ||
|
1 | 18 | require File.dirname(__FILE__) + '/../test_helper' |
|
2 | 19 | |
|
3 | 20 | class TokenTest < Test::Unit::TestCase |
|
4 | 21 | fixtures :tokens |
|
5 | 22 | |
|
6 | # Replace this with your real tests. | |
|
7 | def test_truth | |
|
8 | assert true | |
|
23 | def test_create | |
|
24 | token = Token.new | |
|
25 | token.save | |
|
26 | assert_equal 40, token.value.length | |
|
27 | assert !token.expired? | |
|
9 | 28 | end |
|
10 | 29 | end |
@@ -1,10 +1,43 | |||
|
1 | # redMine - project management software | |
|
2 | # Copyright (C) 2006-2007 Jean-Philippe Lang | |
|
3 | # | |
|
4 | # This program is free software; you can redistribute it and/or | |
|
5 | # modify it under the terms of the GNU General Public License | |
|
6 | # as published by the Free Software Foundation; either version 2 | |
|
7 | # of the License, or (at your option) any later version. | |
|
8 | # | |
|
9 | # This program is distributed in the hope that it will be useful, | |
|
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
|
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
|
12 | # GNU General Public License for more details. | |
|
13 | # | |
|
14 | # You should have received a copy of the GNU General Public License | |
|
15 | # along with this program; if not, write to the Free Software | |
|
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
|
17 | ||
|
1 | 18 | require File.dirname(__FILE__) + '/../test_helper' |
|
2 | 19 | |
|
3 | 20 | class UserPreferenceTest < Test::Unit::TestCase |
|
4 | fixtures :user_preferences | |
|
21 | fixtures :users, :user_preferences | |
|
5 | 22 | |
|
6 | # Replace this with your real tests. | |
|
7 | def test_truth | |
|
8 | assert true | |
|
23 | def test_create | |
|
24 | user = User.new(:firstname => "new", :lastname => "user", :mail => "newuser@somenet.foo") | |
|
25 | user.login = "newuser" | |
|
26 | user.password, user.password_confirmation = "password", "password" | |
|
27 | assert user.save | |
|
28 | ||
|
29 | assert_kind_of UserPreference, user.pref | |
|
30 | assert_kind_of Hash, user.pref.others | |
|
31 | assert user.pref.save | |
|
32 | end | |
|
33 | ||
|
34 | def test_update | |
|
35 | user = User.find(1) | |
|
36 | assert_equal true, user.pref.hide_mail | |
|
37 | user.pref['preftest'] = 'value' | |
|
38 | assert user.pref.save | |
|
39 | ||
|
40 | user.reload | |
|
41 | assert_equal 'value', user.pref['preftest'] | |
|
9 | 42 | end |
|
10 | 43 | end |
General Comments 0
You need to be logged in to leave comments.
Login now