Project

General

Profile

Defect #93 ยป 13201.diff

Nicholas Wieland, 2008-02-03 10:51

View differences:

test/unit/repository_test.rb (copia locale)
def setup
@repository = Project.find(1).repository
end
def test_create
def test_create
repository = Repository::Subversion.new(:project => Project.find(2))
assert !repository.save
repository.url = "svn://localhost"
repository.url = "svn://localhost"
assert repository.save
repository.reload
project = Project.find(2)
assert_equal repository, project.repository
assert_equal repository, project.repository
end
def test_scan_changesets_for_issue_ids
......
# 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' )
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_id => repository )
assert( changeset.save )
assert_not_equal( comment, changeset.comments )
assert_equal( 'This is a loooooooooooooooooooooooooooong comment', changeset.comments )
end
end
test/fixtures/repositories.yml (copia locale)
---
repositories_001:
project_id: 1
url: svn://localhost/test
id: 10
root_url: svn://localhost
password: ""
login: ""
---
repositories_001:
project_id: 1
url: svn://localhost/test
id: 10
root_url: svn://localhost
password: ""
login: ""
app/models/changeset.rb (copia locale)
validates_numericality_of :revision, :only_integer => true
validates_uniqueness_of :revision, :scope => :repository_id
validates_uniqueness_of :scmid, :scope => :repository_id, :allow_nil => true
def comments=(comment)
write_attribute( :comments, comment.strip )
end
def committed_on=(date)
self.commit_date = date
    (1-1/1)