Mercurial > hg > soundsoftware-site
comparison test/functional/.svn/text-base/repositories_mercurial_controller_test.rb.svn-base @ 117:af80e5618e9b redmine-1.1
* Update to Redmine 1.1-stable branch (Redmine SVN rev 4707)
author | Chris Cannam |
---|---|
date | Thu, 13 Jan 2011 12:53:21 +0000 |
parents | 513646585e45 |
children | cd2282d2aa55 |
comparison
equal
deleted
inserted
replaced
39:150ceac17a8d | 117:af80e5618e9b |
---|---|
13 # | 13 # |
14 # You should have received a copy of the GNU General Public License | 14 # You should have received a copy of the GNU General Public License |
15 # along with this program; if not, write to the Free Software | 15 # along with this program; if not, write to the Free Software |
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
17 | 17 |
18 require File.dirname(__FILE__) + '/../test_helper' | 18 require File.expand_path('../../test_helper', __FILE__) |
19 require 'repositories_controller' | 19 require 'repositories_controller' |
20 | 20 |
21 # Re-raise errors caught by the controller. | 21 # Re-raise errors caught by the controller. |
22 class RepositoriesController; def rescue_action(e) raise e end; end | 22 class RepositoriesController; def rescue_action(e) raise e end; end |
23 | 23 |
47 def test_show_root | 47 def test_show_root |
48 get :show, :id => 3 | 48 get :show, :id => 3 |
49 assert_response :success | 49 assert_response :success |
50 assert_template 'show' | 50 assert_template 'show' |
51 assert_not_nil assigns(:entries) | 51 assert_not_nil assigns(:entries) |
52 assert_equal 3, assigns(:entries).size | 52 assert_equal 4, assigns(:entries).size |
53 assert assigns(:entries).detect {|e| e.name == 'images' && e.kind == 'dir'} | 53 assert assigns(:entries).detect {|e| e.name == 'images' && e.kind == 'dir'} |
54 assert assigns(:entries).detect {|e| e.name == 'sources' && e.kind == 'dir'} | 54 assert assigns(:entries).detect {|e| e.name == 'sources' && e.kind == 'dir'} |
55 assert assigns(:entries).detect {|e| e.name == 'README' && e.kind == 'file'} | 55 assert assigns(:entries).detect {|e| e.name == 'README' && e.kind == 'file'} |
56 end | 56 end |
57 | 57 |
58 def test_show_directory | 58 def test_show_directory |
59 get :show, :id => 3, :path => ['images'] | 59 get :show, :id => 3, :path => ['images'] |
60 assert_response :success | 60 assert_response :success |
72 assert_response :success | 72 assert_response :success |
73 assert_template 'show' | 73 assert_template 'show' |
74 assert_not_nil assigns(:entries) | 74 assert_not_nil assigns(:entries) |
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 |
81 assert_template 'changes' | 95 assert_template 'changes' |
82 assert_tag :tag => 'h2', :content => 'edit.png' | 96 assert_tag :tag => 'h2', :content => 'edit.png' |
84 | 98 |
85 def test_entry_show | 99 def test_entry_show |
86 get :entry, :id => 3, :path => ['sources', 'watchers_controller.rb'] | 100 get :entry, :id => 3, :path => ['sources', 'watchers_controller.rb'] |
87 assert_response :success | 101 assert_response :success |
88 assert_template 'entry' | 102 assert_template 'entry' |
89 # Line 19 | 103 # Line 10 |
90 assert_tag :tag => 'th', | 104 assert_tag :tag => 'th', |
91 :content => /10/, | 105 :content => '10', |
92 :attributes => { :class => /line-num/ }, | 106 :attributes => { :class => 'line-num' }, |
93 :sibling => { :tag => 'td', :content => /WITHOUT ANY WARRANTY/ } | 107 :sibling => { :tag => 'td', :content => /WITHOUT ANY WARRANTY/ } |
94 end | 108 end |
95 | 109 |
96 def test_entry_download | 110 def test_entry_download |
97 get :entry, :id => 3, :path => ['sources', 'watchers_controller.rb'], :format => 'raw' | 111 get :entry, :id => 3, :path => ['sources', 'watchers_controller.rb'], :format => 'raw' |
113 get :diff, :id => 3, :rev => 4 | 127 get :diff, :id => 3, :rev => 4 |
114 assert_response :success | 128 assert_response :success |
115 assert_template 'diff' | 129 assert_template 'diff' |
116 # Line 22 removed | 130 # Line 22 removed |
117 assert_tag :tag => 'th', | 131 assert_tag :tag => 'th', |
118 :content => /22/, | 132 :content => '22', |
119 :sibling => { :tag => 'td', | 133 :sibling => { :tag => 'td', |
120 :attributes => { :class => /diff_out/ }, | 134 :attributes => { :class => /diff_out/ }, |
121 :content => /def remove/ } | 135 :content => /def remove/ } |
122 end | 136 end |
123 | 137 |
124 def test_annotate | 138 def test_annotate |
125 get :annotate, :id => 3, :path => ['sources', 'watchers_controller.rb'] | 139 get :annotate, :id => 3, :path => ['sources', 'watchers_controller.rb'] |
126 assert_response :success | 140 assert_response :success |
127 assert_template 'annotate' | 141 assert_template 'annotate' |
128 # Line 23, revision 4 | 142 # Line 23, revision 4:def6d2f1254a |
129 assert_tag :tag => 'th', :content => /23/, | 143 assert_tag :tag => 'th', |
130 :sibling => { :tag => 'td', :child => { :tag => 'a', :content => /4/ } }, | 144 :content => '23', |
131 :sibling => { :tag => 'td', :content => /jsmith/ }, | 145 :attributes => { :class => 'line-num' }, |
146 :sibling => | |
147 { | |
148 :tag => 'td', | |
149 :attributes => { :class => 'revision' }, | |
150 :child => { :tag => 'a', :content => '4' } | |
151 # :child => { :tag => 'a', :content => /4:def6d2f1/ } | |
152 } | |
153 assert_tag :tag => 'th', | |
154 :content => '23', | |
155 :attributes => { :class => 'line-num' }, | |
156 :sibling => | |
157 { | |
158 :tag => 'td' , | |
159 :content => 'jsmith' , | |
160 :attributes => { :class => 'author' }, | |
161 } | |
162 assert_tag :tag => 'th', | |
163 :content => '23', | |
164 :attributes => { :class => 'line-num' }, | |
132 :sibling => { :tag => 'td', :content => /watcher =/ } | 165 :sibling => { :tag => 'td', :content => /watcher =/ } |
133 end | 166 end |
134 else | 167 else |
135 puts "Mercurial test repository NOT FOUND. Skipping functional tests !!!" | 168 puts "Mercurial test repository NOT FOUND. Skipping functional tests !!!" |
136 def test_fake; assert true end | 169 def test_fake; assert true end |