##// END OF EJS Templates
scm: code clean up test/functional/repositories_controller_test.rb....
Toshi MARUYAMA -
r5074:e580dbc6a3eb
parent child
Show More
@@ -22,15 +22,17 require 'repositories_controller'
22 22 class RepositoriesController; def rescue_action(e) raise e end; end
23 23
24 24 class RepositoriesControllerTest < ActionController::TestCase
25 fixtures :projects, :users, :roles, :members, :member_roles, :repositories, :issues, :issue_statuses, :changesets, :changes, :issue_categories, :enumerations, :custom_fields, :custom_values, :trackers
26
25 fixtures :projects, :users, :roles, :members, :member_roles,
26 :repositories, :issues, :issue_statuses, :changesets, :changes,
27 :issue_categories, :enumerations, :custom_fields, :custom_values, :trackers
28
27 29 def setup
28 30 @controller = RepositoriesController.new
29 31 @request = ActionController::TestRequest.new
30 32 @response = ActionController::TestResponse.new
31 33 User.current = nil
32 34 end
33
35
34 36 def test_revisions
35 37 get :revisions, :id => 1
36 38 assert_response :success
@@ -44,7 +46,7 class RepositoriesControllerTest < ActionController::TestCase
44 46 assert_not_nil assigns(:changeset)
45 47 assert_equal "1", assigns(:changeset).revision
46 48 end
47
49
48 50 def test_revision_with_before_nil_and_afer_normal
49 51 get :revision, {:id => 1, :rev => 1}
50 52 assert_response :success
@@ -56,24 +58,30 class RepositoriesControllerTest < ActionController::TestCase
56 58 :child => { :tag => "a", :attributes => { :href => '/projects/ecookbook/repository/revisions/2'}
57 59 }
58 60 end
59
61
60 62 def test_graph_commits_per_month
61 63 get :graph, :id => 1, :graph => 'commits_per_month'
62 64 assert_response :success
63 65 assert_equal 'image/svg+xml', @response.content_type
64 66 end
65
67
66 68 def test_graph_commits_per_author
67 69 get :graph, :id => 1, :graph => 'commits_per_author'
68 70 assert_response :success
69 71 assert_equal 'image/svg+xml', @response.content_type
70 72 end
71
73
72 74 def test_committers
73 75 @request.session[:user_id] = 2
74 76 # add a commit with an unknown user
75 Changeset.create!(:repository => Project.find(1).repository, :committer => 'foo', :committed_on => Time.now, :revision => 100, :comments => 'Committed by foo.')
76
77 Changeset.create!(
78 :repository => Project.find(1).repository,
79 :committer => 'foo',
80 :committed_on => Time.now,
81 :revision => 100,
82 :comments => 'Committed by foo.'
83 )
84
77 85 get :committers, :id => 1
78 86 assert_response :success
79 87 assert_template 'committers'
@@ -94,8 +102,13 class RepositoriesControllerTest < ActionController::TestCase
94 102 def test_map_committers
95 103 @request.session[:user_id] = 2
96 104 # add a commit with an unknown user
97 c = Changeset.create!(:repository => Project.find(1).repository, :committer => 'foo', :committed_on => Time.now, :revision => 100, :comments => 'Committed by foo.')
98
105 c = Changeset.create!(
106 :repository => Project.find(1).repository,
107 :committer => 'foo',
108 :committed_on => Time.now,
109 :revision => 100,
110 :comments => 'Committed by foo.'
111 )
99 112 assert_no_difference "Changeset.count(:conditions => 'user_id = 3')" do
100 113 post :committers, :id => 1, :committers => { '0' => ['foo', '2'], '1' => ['dlopper', '3']}
101 114 assert_redirected_to '/projects/ecookbook/repository/committers'
General Comments 0
You need to be logged in to leave comments. Login now