@@ -26,13 +26,14 class RepositoriesBazaarControllerTest < ActionController::TestCase | |||
|
26 | 26 | |
|
27 | 27 | # No '..' in the repository path |
|
28 | 28 | REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') + '/tmp/test/bazaar_repository' |
|
29 | PRJ_ID = 3 | |
|
29 | 30 | |
|
30 | 31 | def setup |
|
31 | 32 | @controller = RepositoriesController.new |
|
32 | 33 | @request = ActionController::TestRequest.new |
|
33 | 34 | @response = ActionController::TestResponse.new |
|
34 | 35 | User.current = nil |
|
35 |
@project = Project.find( |
|
|
36 | @project = Project.find(PRJ_ID) | |
|
36 | 37 | @repository = Repository::Bazaar.create( |
|
37 | 38 | :project => @project, :url => REPOSITORY_PATH, |
|
38 | 39 | :log_encoding => 'UTF-8') |
@@ -41,7 +42,7 class RepositoriesBazaarControllerTest < ActionController::TestCase | |||
|
41 | 42 | |
|
42 | 43 | if File.directory?(REPOSITORY_PATH) |
|
43 | 44 | def test_show |
|
44 |
get :show, :id => |
|
|
45 | get :show, :id => PRJ_ID | |
|
45 | 46 | assert_response :success |
|
46 | 47 | assert_template 'show' |
|
47 | 48 | assert_not_nil assigns(:entries) |
@@ -49,7 +50,7 class RepositoriesBazaarControllerTest < ActionController::TestCase | |||
|
49 | 50 | end |
|
50 | 51 | |
|
51 | 52 | def test_browse_root |
|
52 |
get :show, :id => |
|
|
53 | get :show, :id => PRJ_ID | |
|
53 | 54 | assert_response :success |
|
54 | 55 | assert_template 'show' |
|
55 | 56 | assert_not_nil assigns(:entries) |
@@ -59,7 +60,7 class RepositoriesBazaarControllerTest < ActionController::TestCase | |||
|
59 | 60 | end |
|
60 | 61 | |
|
61 | 62 | def test_browse_directory |
|
62 |
get :show, :id => |
|
|
63 | get :show, :id => PRJ_ID, :path => ['directory'] | |
|
63 | 64 | assert_response :success |
|
64 | 65 | assert_template 'show' |
|
65 | 66 | assert_not_nil assigns(:entries) |
@@ -71,7 +72,7 class RepositoriesBazaarControllerTest < ActionController::TestCase | |||
|
71 | 72 | end |
|
72 | 73 | |
|
73 | 74 | def test_browse_at_given_revision |
|
74 |
get :show, :id => |
|
|
75 | get :show, :id => PRJ_ID, :path => [], :rev => 3 | |
|
75 | 76 | assert_response :success |
|
76 | 77 | assert_template 'show' |
|
77 | 78 | assert_not_nil assigns(:entries) |
@@ -79,14 +80,14 class RepositoriesBazaarControllerTest < ActionController::TestCase | |||
|
79 | 80 | end |
|
80 | 81 | |
|
81 | 82 | def test_changes |
|
82 |
get :changes, :id => |
|
|
83 | get :changes, :id => PRJ_ID, :path => ['doc-mkdir.txt'] | |
|
83 | 84 | assert_response :success |
|
84 | 85 | assert_template 'changes' |
|
85 | 86 | assert_tag :tag => 'h2', :content => 'doc-mkdir.txt' |
|
86 | 87 | end |
|
87 | 88 | |
|
88 | 89 | def test_entry_show |
|
89 |
get :entry, :id => |
|
|
90 | get :entry, :id => PRJ_ID, :path => ['directory', 'doc-ls.txt'] | |
|
90 | 91 | assert_response :success |
|
91 | 92 | assert_template 'entry' |
|
92 | 93 | # Line 19 |
@@ -97,14 +98,14 class RepositoriesBazaarControllerTest < ActionController::TestCase | |||
|
97 | 98 | end |
|
98 | 99 | |
|
99 | 100 | def test_entry_download |
|
100 |
get :entry, :id => |
|
|
101 | get :entry, :id => PRJ_ID, :path => ['directory', 'doc-ls.txt'], :format => 'raw' | |
|
101 | 102 | assert_response :success |
|
102 | 103 | # File content |
|
103 | 104 | assert @response.body.include?('Show help message') |
|
104 | 105 | end |
|
105 | 106 | |
|
106 | 107 | def test_directory_entry |
|
107 |
get :entry, :id => |
|
|
108 | get :entry, :id => PRJ_ID, :path => ['directory'] | |
|
108 | 109 | assert_response :success |
|
109 | 110 | assert_template 'show' |
|
110 | 111 | assert_not_nil assigns(:entry) |
@@ -113,7 +114,7 class RepositoriesBazaarControllerTest < ActionController::TestCase | |||
|
113 | 114 | |
|
114 | 115 | def test_diff |
|
115 | 116 | # Full diff of changeset 3 |
|
116 |
get :diff, :id => |
|
|
117 | get :diff, :id => PRJ_ID, :rev => 3 | |
|
117 | 118 | assert_response :success |
|
118 | 119 | assert_template 'diff' |
|
119 | 120 | # Line 11 removed |
@@ -125,7 +126,7 class RepositoriesBazaarControllerTest < ActionController::TestCase | |||
|
125 | 126 | end |
|
126 | 127 | |
|
127 | 128 | def test_annotate |
|
128 |
get :annotate, :id => |
|
|
129 | get :annotate, :id => PRJ_ID, :path => ['doc-mkdir.txt'] | |
|
129 | 130 | assert_response :success |
|
130 | 131 | assert_template 'annotate' |
|
131 | 132 | # Line 2, revision 3 |
General Comments 0
You need to be logged in to leave comments.
Login now