Mercurial > hg > soundsoftware-site
comparison test/unit/journal_test.rb @ 1298:4f746d8966dd redmine_2.3_integration
Merge from redmine-2.3 branch to create new branch redmine-2.3-integration
author | Chris Cannam |
---|---|
date | Fri, 14 Jun 2013 09:28:30 +0100 |
parents | 622f24f53b42 |
children |
comparison
equal
deleted
inserted
replaced
1297:0a574315af3e | 1298:4f746d8966dd |
---|---|
1 # Redmine - project management software | 1 # Redmine - project management software |
2 # Copyright (C) 2006-2012 Jean-Philippe Lang | 2 # Copyright (C) 2006-2013 Jean-Philippe Lang |
3 # | 3 # |
4 # This program is free software; you can redistribute it and/or | 4 # This program is free software; you can redistribute it and/or |
5 # modify it under the terms of the GNU General Public License | 5 # modify it under the terms of the GNU General Public License |
6 # as published by the Free Software Foundation; either version 2 | 6 # as published by the Free Software Foundation; either version 2 |
7 # of the License, or (at your option) any later version. | 7 # of the License, or (at your option) any later version. |
39 assert_equal 2, status.id | 39 assert_equal 2, status.id |
40 end | 40 end |
41 | 41 |
42 def test_create_should_send_email_notification | 42 def test_create_should_send_email_notification |
43 ActionMailer::Base.deliveries.clear | 43 ActionMailer::Base.deliveries.clear |
44 issue = Issue.find(:first) | 44 issue = Issue.first |
45 user = User.find(:first) | 45 user = User.first |
46 journal = issue.init_journal(user, issue) | 46 journal = issue.init_journal(user, issue) |
47 | 47 |
48 assert journal.save | 48 assert journal.save |
49 assert_equal 1, ActionMailer::Base.deliveries.size | 49 assert_equal 1, ActionMailer::Base.deliveries.size |
50 end | 50 end |
152 journals = Journal.visible(user).all | 152 journals = Journal.visible(user).all |
153 assert journals.any? | 153 assert journals.any? |
154 # Admin should see issues on private projects that he does not belong to | 154 # Admin should see issues on private projects that he does not belong to |
155 assert journals.detect {|journal| !journal.issue.project.is_public?} | 155 assert journals.detect {|journal| !journal.issue.project.is_public?} |
156 end | 156 end |
157 | |
158 def test_details_should_normalize_dates | |
159 j = JournalDetail.create!(:old_value => Date.parse('2012-11-03'), :value => Date.parse('2013-01-02')) | |
160 j.reload | |
161 assert_equal '2012-11-03', j.old_value | |
162 assert_equal '2013-01-02', j.value | |
163 end | |
164 | |
165 def test_details_should_normalize_true_values | |
166 j = JournalDetail.create!(:old_value => true, :value => true) | |
167 j.reload | |
168 assert_equal '1', j.old_value | |
169 assert_equal '1', j.value | |
170 end | |
171 | |
172 def test_details_should_normalize_false_values | |
173 j = JournalDetail.create!(:old_value => false, :value => false) | |
174 j.reload | |
175 assert_equal '0', j.old_value | |
176 assert_equal '0', j.value | |
177 end | |
157 end | 178 end |