@@ -75,6 +75,20 class RepositoriesMercurialControllerTest < ActionController::TestCase | |||||
75 | assert_equal ['delete.png'], assigns(:entries).collect(&:name) |
|
75 | assert_equal ['delete.png'], assigns(:entries).collect(&:name) | |
76 | end |
|
76 | end | |
77 |
|
77 | |||
|
78 | def test_show_directory_sql_escape_percent | |||
|
79 | get :show, :id => 3, :path => ['sql_escape', 'percent%dir'], :rev => 13 | |||
|
80 | assert_response :success | |||
|
81 | assert_template 'show' | |||
|
82 | ||||
|
83 | assert_not_nil assigns(:entries) | |||
|
84 | assert_equal ['percent%file1.txt', 'percentfile1.txt'], assigns(:entries).collect(&:name) | |||
|
85 | changesets = assigns(:changesets) | |||
|
86 | ||||
|
87 | ## This is not yet implemented. | |||
|
88 | # assert_not_nil changesets | |||
|
89 | # assert_equal %w(13 11 10 9), changesets.collect(&:revision) | |||
|
90 | end | |||
|
91 | ||||
78 | def test_changes |
|
92 | def test_changes | |
79 | get :changes, :id => 3, :path => ['images', 'edit.png'] |
|
93 | get :changes, :id => 3, :path => ['images', 'edit.png'] | |
80 | assert_response :success |
|
94 | assert_response :success |
@@ -80,6 +80,22 class RepositoryMercurialTest < ActiveSupport::TestCase | |||||
80 | assert c0.revision.to_i > c1.revision.to_i |
|
80 | assert c0.revision.to_i > c1.revision.to_i | |
81 | assert c0.committed_on < c1.committed_on |
|
81 | assert c0.committed_on < c1.committed_on | |
82 | end |
|
82 | end | |
|
83 | ||||
|
84 | def test_latest_changesets | |||
|
85 | @repository.fetch_changesets | |||
|
86 | @repository.reload | |||
|
87 | ||||
|
88 | # with_limit | |||
|
89 | changesets = @repository.latest_changesets('', nil, 2) | |||
|
90 | assert_equal @repository.latest_changesets('', nil)[0, 2], changesets | |||
|
91 | ||||
|
92 | # with_filepath | |||
|
93 | changesets = @repository.latest_changesets('/sql_escape/percent%dir/percent%file1.txt', nil) | |||
|
94 | assert_equal %w|11 10 9|, changesets.collect(&:revision) | |||
|
95 | ||||
|
96 | changesets = @repository.latest_changesets('/sql_escape/underscore_dir/understrike_file.txt', nil) | |||
|
97 | assert_equal %w|12 9|, changesets.collect(&:revision) | |||
|
98 | end | |||
83 | else |
|
99 | else | |
84 | puts "Mercurial test repository NOT FOUND. Skipping unit tests !!!" |
|
100 | puts "Mercurial test repository NOT FOUND. Skipping unit tests !!!" | |
85 | def test_fake; assert true end |
|
101 | def test_fake; assert true end |
General Comments 0
You need to be logged in to leave comments.
Login now