##// END OF EJS Templates
Backed out r7442....
Backed out r7442. Merged r7439 from trunk. Slovenian translation of trunk r5957 and 1.2-stable r7434 updated. Contributed by Nejc Vidmar. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.2-stable@7449 e93f8b46-1217-0410-a6f0-8f06a7374b81

File last commit:

r5079:bf251a586b98
r7329:5c282222a011
Show More
repositories_darcs_controller_test.rb
108 lines | 3.9 KiB | text/x-ruby | RubyLexer
/ test / functional / repositories_darcs_controller_test.rb
Jean-Philippe Lang
Merged Git support branch (r1200 to r1226)....
r1222 # redMine - project management software
# Copyright (C) 2006-2008 Jean-Philippe Lang
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Jean-Baptiste Barth
Use absolute paths in test/**/* requires for Ruby 1.9.2 compatibility. #4050...
r4395 require File.expand_path('../../test_helper', __FILE__)
Jean-Philippe Lang
Merged Git support branch (r1200 to r1226)....
r1222 require 'repositories_controller'
# Re-raise errors caught by the controller.
class RepositoriesController; def rescue_action(e) raise e end; end
Eric Davis
Upgraded to Rails 2.3.4 (#3597)...
r2773 class RepositoriesDarcsControllerTest < ActionController::TestCase
Jean-Philippe Lang
Allows multiple roles on the same project (#706). Prerequisite for user groups feature....
r2627 fixtures :projects, :users, :roles, :members, :member_roles, :repositories, :enabled_modules
Jean-Philippe Lang
Merged Git support branch (r1200 to r1226)....
r1222
# No '..' in the repository path
REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') + '/tmp/test/darcs_repository'
Toshi MARUYAMA
scm: darcs: refactor functional test....
r4859 PRJ_ID = 3
Jean-Philippe Lang
Merged Git support branch (r1200 to r1226)....
r1222
def setup
@controller = RepositoriesController.new
@request = ActionController::TestRequest.new
@response = ActionController::TestResponse.new
User.current = nil
Toshi MARUYAMA
scm: darcs: refactor functional test....
r4859 @project = Project.find(PRJ_ID)
Toshi MARUYAMA
scm: add feature of per project repository log encoding setting (#1735)....
r4862 @repository = Repository::Darcs.create(
:project => @project, :url => REPOSITORY_PATH,
:log_encoding => 'UTF-8')
Toshi MARUYAMA
scm: darcs: refactor functional test....
r4859 assert @repository
Jean-Philippe Lang
Merged Git support branch (r1200 to r1226)....
r1222 end
Toshi MARUYAMA
scm: darcs: refactor functional test....
r4859
Jean-Philippe Lang
Merged Git support branch (r1200 to r1226)....
r1222 if File.directory?(REPOSITORY_PATH)
def test_browse_root
Toshi MARUYAMA
scm: darcs: refactor functional test....
r4859 @repository.fetch_changesets
@repository.reload
get :show, :id => PRJ_ID
Jean-Philippe Lang
Merged Git support branch (r1200 to r1226)....
r1222 assert_response :success
Eric Davis
Added branch and tag support to the git repository viewer. (#1406)...
r2735 assert_template 'show'
Jean-Philippe Lang
Merged Git support branch (r1200 to r1226)....
r1222 assert_not_nil assigns(:entries)
assert_equal 3, assigns(:entries).size
assert assigns(:entries).detect {|e| e.name == 'images' && e.kind == 'dir'}
assert assigns(:entries).detect {|e| e.name == 'sources' && e.kind == 'dir'}
assert assigns(:entries).detect {|e| e.name == 'README' && e.kind == 'file'}
end
Toshi MARUYAMA
scm: darcs: refactor functional test....
r4859
Jean-Philippe Lang
Merged Git support branch (r1200 to r1226)....
r1222 def test_browse_directory
Toshi MARUYAMA
scm: darcs: refactor functional test....
r4859 @repository.fetch_changesets
@repository.reload
get :show, :id => PRJ_ID, :path => ['images']
Jean-Philippe Lang
Merged Git support branch (r1200 to r1226)....
r1222 assert_response :success
Eric Davis
Added branch and tag support to the git repository viewer. (#1406)...
r2735 assert_template 'show'
Jean-Philippe Lang
Merged Git support branch (r1200 to r1226)....
r1222 assert_not_nil assigns(:entries)
Jean-Philippe Lang
Fix repository browsing at given revision for various scm and add tests for this....
r1314 assert_equal ['delete.png', 'edit.png'], assigns(:entries).collect(&:name)
Jean-Philippe Lang
Merged Git support branch (r1200 to r1226)....
r1222 entry = assigns(:entries).detect {|e| e.name == 'edit.png'}
assert_not_nil entry
assert_equal 'file', entry.kind
assert_equal 'images/edit.png', entry.path
end
Toshi MARUYAMA
scm: darcs: refactor functional test....
r4859
Jean-Philippe Lang
Fix repository browsing at given revision for various scm and add tests for this....
r1314 def test_browse_at_given_revision
Toshi MARUYAMA
scm: darcs: refactor functional test....
r4859 @repository.fetch_changesets
@repository.reload
get :show, :id => PRJ_ID, :path => ['images'], :rev => 1
Jean-Philippe Lang
Fix repository browsing at given revision for various scm and add tests for this....
r1314 assert_response :success
Eric Davis
Added branch and tag support to the git repository viewer. (#1406)...
r2735 assert_template 'show'
Jean-Philippe Lang
Fix repository browsing at given revision for various scm and add tests for this....
r1314 assert_not_nil assigns(:entries)
assert_equal ['delete.png'], assigns(:entries).collect(&:name)
end
Toshi MARUYAMA
scm: darcs: refactor functional test....
r4859
Jean-Philippe Lang
Merged Git support branch (r1200 to r1226)....
r1222 def test_changes
Toshi MARUYAMA
scm: darcs: refactor functional test....
r4859 @repository.fetch_changesets
@repository.reload
get :changes, :id => PRJ_ID, :path => ['images', 'edit.png']
Jean-Philippe Lang
Merged Git support branch (r1200 to r1226)....
r1222 assert_response :success
assert_template 'changes'
assert_tag :tag => 'h2', :content => 'edit.png'
end
Toshi MARUYAMA
scm: darcs: refactor functional test....
r4859
Jean-Philippe Lang
Merged Git support branch (r1200 to r1226)....
r1222 def test_diff
Toshi MARUYAMA
scm: darcs: refactor functional test....
r4859 @repository.fetch_changesets
@repository.reload
Jean-Philippe Lang
Merged Git support branch (r1200 to r1226)....
r1222 # Full diff of changeset 5
Toshi MARUYAMA
scm: darcs: refactor functional test....
r4859 get :diff, :id => PRJ_ID, :rev => 5
Jean-Philippe Lang
Merged Git support branch (r1200 to r1226)....
r1222 assert_response :success
assert_template 'diff'
# Line 22 removed
assert_tag :tag => 'th',
:content => /22/,
:sibling => { :tag => 'td',
:attributes => { :class => /diff_out/ },
:content => /def remove/ }
end
else
puts "Darcs test repository NOT FOUND. Skipping functional tests !!!"
def test_fake; assert true end
end
end