Project

General

Profile

Defect #5548 » 0001-adding-test-for-5548-square-brackets-in-svn-paths.patch

Gregor Schmidt, 2010-06-20 15:15

View differences:

test/unit/repository_subversion_test.rb
18 18
require File.dirname(__FILE__) + '/../test_helper'
19 19

  
20 20
class RepositorySubversionTest < ActiveSupport::TestCase
21
  fixtures :projects
21
  fixtures :projects, :repositories
22 22
  
23 23
  def setup
24 24
    @project = Project.find(1)
......
30 30
      @repository.fetch_changesets
31 31
      @repository.reload
32 32
      
33
      assert_equal 10, @repository.changesets.count
34
      assert_equal 18, @repository.changes.count
33
      assert_equal 11, @repository.changesets.count
34
      assert_equal 20, @repository.changes.count
35 35
      assert_equal 'Initial import.', @repository.changesets.find_by_revision('1').comments
36 36
    end
37 37
    
......
43 43
      assert_equal 5, @repository.changesets.count
44 44
      
45 45
      @repository.fetch_changesets
46
      assert_equal 10, @repository.changesets.count
46
      assert_equal 11, @repository.changesets.count
47 47
    end
48 48
    
49 49
    def test_latest_changesets
......
62 62
      changesets = @repository.latest_changesets('subversion_test/folder', 8)
63 63
      assert_equal ["7", "6", "5", "2"], changesets.collect(&:revision)
64 64
    end
65

  
66
    def test_directory_listing_with_square_brackets_in_path
67
      @repository.fetch_changesets
68
      @repository.reload
69
      
70
      entries = @repository.entries('subversion_test/[folder_with_brackets]')
71
      assert_not_nil entries, 'Expect to find entries in folder_with_brackets'
72
      assert_equal 1, entries.size, 'Expect one entry in folder_with_brackets'
73
      assert_equal 'README.txt', entries.first.name
74
    end
75

  
76
    def test_directory_listing_with_square_brackets_in_base
77
      @project = Project.find(1)
78
      @repository = Repository::Subversion.create(:project => @project, :url => "file:///#{self.class.repository_path('subversion')}/subversion_test/[folder_with_brackets]")
79

  
80
      @repository.fetch_changesets
81
      @repository.reload
82

  
83
      assert_equal 1, @repository.changesets.count, 'Expected to see 1 revision'
84
      assert_equal 2, @repository.changes.count, 'Expected to see 2 changes, dir add and file add'
85

  
86
      entries = @repository.entries('')
87
      assert_not_nil entries, 'Expect to find entries'
88
      assert_equal 1, entries.size, 'Expect a single entry'
89
      assert_equal 'README.txt', entries.first.name
90
    end
65 91
  else
66 92
    puts "Subversion test repository NOT FOUND. Skipping unit tests !!!"
67 93
    def test_fake; assert true end
(2-2/5)