##// END OF EJS Templates
scm: cvs: code clean up functional test....
Toshi MARUYAMA -
r4961:f41848fda457
parent child
Show More
@@ -39,13 +39,13 class RepositoriesCvsControllerTest < ActionController::TestCase
39 User.current = nil
39 User.current = nil
40
40
41 @project = Project.find(PRJ_ID)
41 @project = Project.find(PRJ_ID)
42 @repository = Repository::Cvs.create(:project => Project.find(PRJ_ID),
42 @repository = Repository::Cvs.create(:project => Project.find(PRJ_ID),
43 :root_url => REPOSITORY_PATH,
43 :root_url => REPOSITORY_PATH,
44 :url => MODULE_NAME,
44 :url => MODULE_NAME,
45 :log_encoding => 'UTF-8')
45 :log_encoding => 'UTF-8')
46 assert @repository
46 assert @repository
47 end
47 end
48
48
49 if File.directory?(REPOSITORY_PATH)
49 if File.directory?(REPOSITORY_PATH)
50 def test_show
50 def test_show
51 @repository.fetch_changesets
51 @repository.fetch_changesets
@@ -56,7 +56,7 class RepositoriesCvsControllerTest < ActionController::TestCase
56 assert_not_nil assigns(:entries)
56 assert_not_nil assigns(:entries)
57 assert_not_nil assigns(:changesets)
57 assert_not_nil assigns(:changesets)
58 end
58 end
59
59
60 def test_browse_root
60 def test_browse_root
61 @repository.fetch_changesets
61 @repository.fetch_changesets
62 @repository.reload
62 @repository.reload
@@ -65,14 +65,14 class RepositoriesCvsControllerTest < ActionController::TestCase
65 assert_template 'show'
65 assert_template 'show'
66 assert_not_nil assigns(:entries)
66 assert_not_nil assigns(:entries)
67 assert_equal 3, assigns(:entries).size
67 assert_equal 3, assigns(:entries).size
68
68
69 entry = assigns(:entries).detect {|e| e.name == 'images'}
69 entry = assigns(:entries).detect {|e| e.name == 'images'}
70 assert_equal 'dir', entry.kind
70 assert_equal 'dir', entry.kind
71
71
72 entry = assigns(:entries).detect {|e| e.name == 'README'}
72 entry = assigns(:entries).detect {|e| e.name == 'README'}
73 assert_equal 'file', entry.kind
73 assert_equal 'file', entry.kind
74 end
74 end
75
75
76 def test_browse_directory
76 def test_browse_directory
77 @repository.fetch_changesets
77 @repository.fetch_changesets
78 @repository.reload
78 @repository.reload
@@ -86,7 +86,7 class RepositoriesCvsControllerTest < ActionController::TestCase
86 assert_equal 'file', entry.kind
86 assert_equal 'file', entry.kind
87 assert_equal 'images/edit.png', entry.path
87 assert_equal 'images/edit.png', entry.path
88 end
88 end
89
89
90 def test_browse_at_given_revision
90 def test_browse_at_given_revision
91 @repository.fetch_changesets
91 @repository.fetch_changesets
92 @repository.reload
92 @repository.reload
@@ -96,7 +96,7 class RepositoriesCvsControllerTest < ActionController::TestCase
96 assert_not_nil assigns(:entries)
96 assert_not_nil assigns(:entries)
97 assert_equal ['delete.png', 'edit.png'], assigns(:entries).collect(&:name)
97 assert_equal ['delete.png', 'edit.png'], assigns(:entries).collect(&:name)
98 end
98 end
99
99
100 def test_entry
100 def test_entry
101 @repository.fetch_changesets
101 @repository.fetch_changesets
102 @repository.reload
102 @repository.reload
@@ -106,7 +106,7 class RepositoriesCvsControllerTest < ActionController::TestCase
106 assert_no_tag :tag => 'td', :attributes => { :class => /line-code/},
106 assert_no_tag :tag => 'td', :attributes => { :class => /line-code/},
107 :content => /before_filter/
107 :content => /before_filter/
108 end
108 end
109
109
110 def test_entry_at_given_revision
110 def test_entry_at_given_revision
111 # changesets must be loaded
111 # changesets must be loaded
112 @repository.fetch_changesets
112 @repository.fetch_changesets
@@ -118,7 +118,7 class RepositoriesCvsControllerTest < ActionController::TestCase
118 assert_tag :tag => 'td', :attributes => { :class => /line-code/},
118 assert_tag :tag => 'td', :attributes => { :class => /line-code/},
119 :content => /before_filter/
119 :content => /before_filter/
120 end
120 end
121
121
122 def test_entry_not_found
122 def test_entry_not_found
123 @repository.fetch_changesets
123 @repository.fetch_changesets
124 @repository.reload
124 @repository.reload
@@ -126,7 +126,7 class RepositoriesCvsControllerTest < ActionController::TestCase
126 assert_tag :tag => 'p', :attributes => { :id => /errorExplanation/ },
126 assert_tag :tag => 'p', :attributes => { :id => /errorExplanation/ },
127 :content => /The entry or revision was not found in the repository/
127 :content => /The entry or revision was not found in the repository/
128 end
128 end
129
129
130 def test_entry_download
130 def test_entry_download
131 @repository.fetch_changesets
131 @repository.fetch_changesets
132 @repository.reload
132 @repository.reload
@@ -143,7 +143,7 class RepositoriesCvsControllerTest < ActionController::TestCase
143 assert_not_nil assigns(:entry)
143 assert_not_nil assigns(:entry)
144 assert_equal 'sources', assigns(:entry).name
144 assert_equal 'sources', assigns(:entry).name
145 end
145 end
146
146
147 def test_diff
147 def test_diff
148 @repository.fetch_changesets
148 @repository.fetch_changesets
149 @repository.reload
149 @repository.reload
@@ -155,7 +155,7 class RepositoriesCvsControllerTest < ActionController::TestCase
155 assert_tag :tag => 'td', :attributes => { :class => 'line-code diff_in' },
155 assert_tag :tag => 'td', :attributes => { :class => 'line-code diff_in' },
156 :content => /watched.remove_all_watcher/
156 :content => /watched.remove_all_watcher/
157 end
157 end
158
158
159 def test_diff_new_files
159 def test_diff_new_files
160 @repository.fetch_changesets
160 @repository.fetch_changesets
161 @repository.reload
161 @repository.reload
@@ -171,7 +171,7 class RepositoriesCvsControllerTest < ActionController::TestCase
171 assert_tag :tag => 'th', :attributes => { :class => 'filename' },
171 assert_tag :tag => 'th', :attributes => { :class => 'filename' },
172 :content => /test\/images\/edit.png/
172 :content => /test\/images\/edit.png/
173 assert_tag :tag => 'th', :attributes => { :class => 'filename' },
173 assert_tag :tag => 'th', :attributes => { :class => 'filename' },
174 :content => /test\/sources\/watchers_controller.rb/
174 :content => /test\/sources\/watchers_controller.rb/
175 end
175 end
176
176
177 def test_annotate
177 def test_annotate
General Comments 0
You need to be logged in to leave comments. Login now