Defect #93 ยป 13201.diff
test/unit/repository_test.rb (copia locale) | ||
---|---|---|
23 | 23 |
def setup |
24 | 24 |
@repository = Project.find(1).repository |
25 | 25 |
end |
26 |
|
|
27 |
def test_create
|
|
26 |
|
|
27 |
def test_create |
|
28 | 28 |
repository = Repository::Subversion.new(:project => Project.find(2)) |
29 | 29 |
assert !repository.save |
30 | 30 |
|
31 |
repository.url = "svn://localhost"
|
|
31 |
repository.url = "svn://localhost" |
|
32 | 32 |
assert repository.save |
33 | 33 |
repository.reload |
34 | 34 |
|
35 | 35 |
project = Project.find(2) |
36 |
assert_equal repository, project.repository
|
|
36 |
assert_equal repository, project.repository |
|
37 | 37 |
end |
38 | 38 |
|
39 | 39 |
def test_scan_changesets_for_issue_ids |
... | ... | |
53 | 53 |
# ignoring commits referencing an issue of another project |
54 | 54 |
assert_equal [], Issue.find(4).changesets |
55 | 55 |
end |
56 |
|
|
57 |
def test_for_changeset_comments_strip |
|
58 |
repository = Repository::Mercurial.create( :project => Project.find( 4 ), :url => '/foo/bar/baz' ) |
|
59 |
comment = <<-COMMENT |
|
60 |
This is a loooooooooooooooooooooooooooong comment |
|
61 |
|
|
62 |
|
|
63 |
COMMENT |
|
64 |
changeset = Changeset.new( |
|
65 |
:comments => comment, :commit_date => Time.now, :revision => 0, :scmid => 'f39b7922fb3c', |
|
66 |
:committer => 'foo <foo@example.com>', :committed_on => Time.now, :repository_id => repository ) |
|
67 |
assert( changeset.save ) |
|
68 |
assert_not_equal( comment, changeset.comments ) |
|
69 |
assert_equal( 'This is a loooooooooooooooooooooooooooong comment', changeset.comments ) |
|
70 |
end |
|
71 |
|
|
56 | 72 |
end |
test/fixtures/repositories.yml (copia locale) | ||
---|---|---|
1 |
--- |
|
2 |
repositories_001: |
|
3 |
project_id: 1 |
|
4 |
url: svn://localhost/test |
|
5 |
id: 10 |
|
6 |
root_url: svn://localhost |
|
7 |
password: "" |
|
8 |
login: "" |
|
1 |
--- |
|
2 |
repositories_001: |
|
3 |
project_id: 1 |
|
4 |
url: svn://localhost/test |
|
5 |
id: 10 |
|
6 |
root_url: svn://localhost |
|
7 |
password: "" |
|
8 |
login: "" |
app/models/changeset.rb (copia locale) | ||
---|---|---|
24 | 24 |
validates_numericality_of :revision, :only_integer => true |
25 | 25 |
validates_uniqueness_of :revision, :scope => :repository_id |
26 | 26 |
validates_uniqueness_of :scmid, :scope => :repository_id, :allow_nil => true |
27 | ||
28 |
def comments=(comment) |
|
29 |
write_attribute( :comments, comment.strip ) |
|
30 |
end |
|
27 | 31 |
|
28 | 32 |
def committed_on=(date) |
29 | 33 |
self.commit_date = date |