summaryrefslogtreecommitdiffstats
path: root/test/unit/repository_test.rb
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2011-05-08 14:08:46 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2011-05-08 14:08:46 +0000
commita05a2e0c4d0d67c97280e487cdc33e9a778c8524 (patch)
treebc8b442a287a30d6ed5a0f659cd16c2b6023b527 /test/unit/repository_test.rb
parent615c81f3df5be7da184aba97ffa768b51b7fa8bb (diff)
downloadredmine-a05a2e0c4d0d67c97280e487cdc33e9a778c8524.tar.gz
redmine-a05a2e0c4d0d67c97280e487cdc33e9a778c8524.zip
scm: code clean up unit repository test.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5709 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/repository_test.rb')
-rw-r--r--test/unit/repository_test.rb35
1 files changed, 24 insertions, 11 deletions
diff --git a/test/unit/repository_test.rb b/test/unit/repository_test.rb
index 95bb65b08..f1f80e272 100644
--- a/test/unit/repository_test.rb
+++ b/test/unit/repository_test.rb
@@ -52,7 +52,8 @@ class RepositoryTest < ActiveSupport::TestCase
def test_destroy
changesets = Changeset.count(:all, :conditions => "repository_id = 10")
- changes = Change.count(:all, :conditions => "repository_id = 10", :include => :changeset)
+ changes = Change.count(:all, :conditions => "repository_id = 10",
+ :include => :changeset)
assert_difference 'Changeset.count', -changesets do
assert_difference 'Change.count', -changes do
Repository.find(10).destroy
@@ -63,9 +64,11 @@ class RepositoryTest < ActiveSupport::TestCase
def test_should_not_create_with_disabled_scm
# disable Subversion
with_settings :enabled_scm => ['Darcs', 'Git'] do
- repository = Repository::Subversion.new(:project => Project.find(3), :url => "svn://localhost")
+ repository = Repository::Subversion.new(
+ :project => Project.find(3), :url => "svn://localhost")
assert !repository.save
- assert_equal I18n.translate('activerecord.errors.messages.invalid'), repository.errors.on(:type)
+ assert_equal I18n.translate('activerecord.errors.messages.invalid'),
+ repository.errors.on(:type)
end
end
@@ -74,7 +77,9 @@ class RepositoryTest < ActiveSupport::TestCase
Setting.notified_events = ['issue_added','issue_updated']
# choosing a status to apply to fix issues
- Setting.commit_fix_status_id = IssueStatus.find(:first, :conditions => ["is_closed = ?", true]).id
+ Setting.commit_fix_status_id = IssueStatus.find(
+ :first,
+ :conditions => ["is_closed = ?", true]).id
Setting.commit_fix_done_ratio = "90"
Setting.commit_ref_keywords = 'refs , references, IssueID'
Setting.commit_fix_keywords = 'fixes , closes'
@@ -104,26 +109,33 @@ class RepositoryTest < ActiveSupport::TestCase
assert_equal 2, ActionMailer::Base.deliveries.size
mail = ActionMailer::Base.deliveries.first
assert_kind_of TMail::Mail, mail
- assert mail.subject.starts_with?("[#{fixed_issue.project.name} - #{fixed_issue.tracker.name} ##{fixed_issue.id}]")
- assert mail.body.include?("Status changed from #{old_status} to #{fixed_issue.status}")
+ assert mail.subject.starts_with?(
+ "[#{fixed_issue.project.name} - #{fixed_issue.tracker.name} ##{fixed_issue.id}]")
+ assert mail.body.include?(
+ "Status changed from #{old_status} to #{fixed_issue.status}")
# ignoring commits referencing an issue of another project
assert_equal [], Issue.find(4).changesets
end
def test_for_changeset_comments_strip
- repository = Repository::Mercurial.create( :project => Project.find( 4 ), :url => '/foo/bar/baz' )
+ repository = Repository::Mercurial.create(
+ :project => Project.find( 4 ),
+ :url => '/foo/bar/baz' )
comment = <<-COMMENT
This is a loooooooooooooooooooooooooooong comment
COMMENT
changeset = Changeset.new(
- :comments => comment, :commit_date => Time.now, :revision => 0, :scmid => 'f39b7922fb3c',
- :committer => 'foo <foo@example.com>', :committed_on => Time.now, :repository => repository )
+ :comments => comment, :commit_date => Time.now,
+ :revision => 0, :scmid => 'f39b7922fb3c',
+ :committer => 'foo <foo@example.com>',
+ :committed_on => Time.now, :repository => repository )
assert( changeset.save )
assert_not_equal( comment, changeset.comments )
- assert_equal( 'This is a loooooooooooooooooooooooooooong comment', changeset.comments )
+ assert_equal( 'This is a loooooooooooooooooooooooooooong comment',
+ changeset.comments )
end
def test_for_urls_strip
@@ -134,7 +146,8 @@ class RepositoryTest < ActiveSupport::TestCase
:log_encoding => 'UTF-8')
assert repository.save
repository.reload
- assert_equal ':pserver:login:password@host:/path/to/the/repository', repository.url
+ assert_equal ':pserver:login:password@host:/path/to/the/repository',
+ repository.url
assert_equal 'foo', repository.root_url
end