@@ -45,7 +45,7 class RepositoryTest < ActiveSupport::TestCase | |||||
45 | repository.url = "svn://localhost" |
|
45 | repository.url = "svn://localhost" | |
46 | assert repository.save |
|
46 | assert repository.save | |
47 | repository.reload |
|
47 | repository.reload | |
48 |
|
48 | |||
49 | project = Project.find(3) |
|
49 | project = Project.find(3) | |
50 | assert_equal repository, project.repository |
|
50 | assert_equal repository, project.repository | |
51 | end |
|
51 | end | |
@@ -72,7 +72,7 class RepositoryTest < ActiveSupport::TestCase | |||||
72 | def test_scan_changesets_for_issue_ids |
|
72 | def test_scan_changesets_for_issue_ids | |
73 | Setting.default_language = 'en' |
|
73 | Setting.default_language = 'en' | |
74 | Setting.notified_events = ['issue_added','issue_updated'] |
|
74 | Setting.notified_events = ['issue_added','issue_updated'] | |
75 |
|
75 | |||
76 | # choosing a status to apply to fix issues |
|
76 | # choosing a status to apply to fix issues | |
77 | Setting.commit_fix_status_id = IssueStatus.find(:first, :conditions => ["is_closed = ?", true]).id |
|
77 | Setting.commit_fix_status_id = IssueStatus.find(:first, :conditions => ["is_closed = ?", true]).id | |
78 | Setting.commit_fix_done_ratio = "90" |
|
78 | Setting.commit_fix_done_ratio = "90" | |
@@ -80,33 +80,33 class RepositoryTest < ActiveSupport::TestCase | |||||
80 | Setting.commit_fix_keywords = 'fixes , closes' |
|
80 | Setting.commit_fix_keywords = 'fixes , closes' | |
81 | Setting.default_language = 'en' |
|
81 | Setting.default_language = 'en' | |
82 | ActionMailer::Base.deliveries.clear |
|
82 | ActionMailer::Base.deliveries.clear | |
83 |
|
83 | |||
84 | # make sure issue 1 is not already closed |
|
84 | # make sure issue 1 is not already closed | |
85 | fixed_issue = Issue.find(1) |
|
85 | fixed_issue = Issue.find(1) | |
86 | assert !fixed_issue.status.is_closed? |
|
86 | assert !fixed_issue.status.is_closed? | |
87 | old_status = fixed_issue.status |
|
87 | old_status = fixed_issue.status | |
88 |
|
88 | |||
89 | Repository.scan_changesets_for_issue_ids |
|
89 | Repository.scan_changesets_for_issue_ids | |
90 | assert_equal [101, 102], Issue.find(3).changeset_ids |
|
90 | assert_equal [101, 102], Issue.find(3).changeset_ids | |
91 |
|
91 | |||
92 | # fixed issues |
|
92 | # fixed issues | |
93 | fixed_issue.reload |
|
93 | fixed_issue.reload | |
94 | assert fixed_issue.status.is_closed? |
|
94 | assert fixed_issue.status.is_closed? | |
95 | assert_equal 90, fixed_issue.done_ratio |
|
95 | assert_equal 90, fixed_issue.done_ratio | |
96 | assert_equal [101], fixed_issue.changeset_ids |
|
96 | assert_equal [101], fixed_issue.changeset_ids | |
97 |
|
97 | |||
98 | # issue change |
|
98 | # issue change | |
99 | journal = fixed_issue.journals.find(:first, :order => 'created_on desc') |
|
99 | journal = fixed_issue.journals.find(:first, :order => 'created_on desc') | |
100 | assert_equal User.find_by_login('dlopper'), journal.user |
|
100 | assert_equal User.find_by_login('dlopper'), journal.user | |
101 | assert_equal 'Applied in changeset r2.', journal.notes |
|
101 | assert_equal 'Applied in changeset r2.', journal.notes | |
102 |
|
102 | |||
103 | # 2 email notifications |
|
103 | # 2 email notifications | |
104 | assert_equal 2, ActionMailer::Base.deliveries.size |
|
104 | assert_equal 2, ActionMailer::Base.deliveries.size | |
105 | mail = ActionMailer::Base.deliveries.first |
|
105 | mail = ActionMailer::Base.deliveries.first | |
106 | assert_kind_of TMail::Mail, mail |
|
106 | assert_kind_of TMail::Mail, mail | |
107 | assert mail.subject.starts_with?("[#{fixed_issue.project.name} - #{fixed_issue.tracker.name} ##{fixed_issue.id}]") |
|
107 | assert mail.subject.starts_with?("[#{fixed_issue.project.name} - #{fixed_issue.tracker.name} ##{fixed_issue.id}]") | |
108 | assert mail.body.include?("Status changed from #{old_status} to #{fixed_issue.status}") |
|
108 | assert mail.body.include?("Status changed from #{old_status} to #{fixed_issue.status}") | |
109 |
|
109 | |||
110 | # ignoring commits referencing an issue of another project |
|
110 | # ignoring commits referencing an issue of another project | |
111 | assert_equal [], Issue.find(4).changesets |
|
111 | assert_equal [], Issue.find(4).changesets | |
112 | end |
|
112 | end |
General Comments 0
You need to be logged in to leave comments.
Login now