##// END OF EJS Templates
add unit test to set project if project is nil at unit time entry test...
add unit test to set project if project is nil at unit time entry test git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@7452 e93f8b46-1217-0410-a6f0-8f06a7374b81

File last commit:

r7096:e42b15201106
r7332:5778c264349e
Show More
repositories_subversion_controller_test.rb
379 lines | 14.1 KiB | text/x-ruby | RubyLexer
/ test / functional / repositories_subversion_controller_test.rb
Jean-Philippe Lang
Fixes subversion tests not running on win32....
r5055 # Redmine - project management software
# Copyright (C) 2006-2011 Jean-Philippe Lang
Jean-Philippe Lang
Added some functional tests (projects and repositories)....
r968 #
# 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.
Toshi MARUYAMA
scm: subversion: remove trailing white-spaces from functional test....
r5581 #
Jean-Philippe Lang
Added some functional tests (projects and repositories)....
r968 # 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.
Toshi MARUYAMA
scm: subversion: remove trailing white-spaces from functional test....
r5581 #
Jean-Philippe Lang
Added some functional tests (projects and repositories)....
r968 # 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
Added some functional tests (projects and repositories)....
r968 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 RepositoriesSubversionControllerTest < 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, :enabled_modules,
Jean-Philippe Lang
Functional tests fail when run on their own (#1895)....
r1826 :repositories, :issues, :issue_statuses, :changesets, :changes,
:issue_categories, :enumerations, :custom_fields, :custom_values, :trackers
Jean-Philippe Lang
Added some functional tests (projects and repositories)....
r968
Toshi MARUYAMA
scm: subversion: change some functional tests project id from 1 to 3....
r4776 PRJ_ID = 3
Toshi MARUYAMA
scm: subversion: define NUM_REV as the number of test repository revisions at functional test...
r7052 NUM_REV = 11
Toshi MARUYAMA
scm: subversion: change some functional tests project id from 1 to 3....
r4776
Jean-Philippe Lang
Added some functional tests (projects and repositories)....
r968 def setup
@controller = RepositoriesController.new
@request = ActionController::TestRequest.new
@response = ActionController::TestResponse.new
Jean-Philippe Lang
Fixed: CVS repository doesn't work if port is used in the url (#653)....
r1142 Setting.default_language = 'en'
Jean-Philippe Lang
Added some functional tests (projects and repositories)....
r968 User.current = nil
Toshi MARUYAMA
scm: subversion: change some functional tests project id from 1 to 3....
r4776
@project = Project.find(PRJ_ID)
@repository = Repository::Subversion.create(:project => @project,
Jean-Philippe Lang
Fixes subversion tests not running on win32....
r5055 :url => self.class.subversion_repository_url)
Toshi MARUYAMA
scm: subversion: change some functional tests project id from 1 to 3....
r4776 assert @repository
Jean-Philippe Lang
Added some functional tests (projects and repositories)....
r968 end
Jean-Philippe Lang
Adds test helpers for test repositories....
r3606 if repository_configured?('subversion')
Jean-Philippe Lang
Added some functional tests (projects and repositories)....
r968 def test_show
Toshi MARUYAMA
Rails3: scm: subversion: fix error of test_show at unit model test...
r7053 assert_equal 0, @repository.changesets.count
Toshi MARUYAMA
scm: subversion: change some functional tests project id from 1 to 3....
r4776 @repository.fetch_changesets
Toshi MARUYAMA
Rails3: scm: subversion: fix error of test_show at unit model test...
r7053 @project.reload
assert_equal NUM_REV, @repository.changesets.count
Toshi MARUYAMA
scm: subversion: change some functional tests project id from 1 to 3....
r4776 get :show, :id => PRJ_ID
Jean-Philippe Lang
Added some functional tests (projects and repositories)....
r968 assert_response :success
assert_template 'show'
assert_not_nil assigns(:entries)
assert_not_nil assigns(:changesets)
end
Toshi MARUYAMA
scm: subversion: code clean up functional test....
r5441
Jean-Philippe Lang
Added some functional tests (projects and repositories)....
r968 def test_browse_root
Toshi MARUYAMA
Rails3: scm: subversion: fix error of test_browse_root at functional test...
r7075 assert_equal 0, @repository.changesets.count
Toshi MARUYAMA
scm: subversion: change some functional tests project id from 1 to 3....
r4776 @repository.fetch_changesets
Toshi MARUYAMA
Rails3: scm: subversion: fix error of test_browse_root at functional test...
r7075 @project.reload
assert_equal NUM_REV, @repository.changesets.count
Toshi MARUYAMA
scm: subversion: change some functional tests project id from 1 to 3....
r4776 get :show, :id => PRJ_ID
Jean-Philippe Lang
Added some functional tests (projects and repositories)....
r968 assert_response :success
Eric Davis
Added branch and tag support to the git repository viewer. (#1406)...
r2735 assert_template 'show'
Jean-Philippe Lang
Added some functional tests (projects and repositories)....
r968 assert_not_nil assigns(:entries)
entry = assigns(:entries).detect {|e| e.name == 'subversion_test'}
assert_equal 'dir', entry.kind
end
Toshi MARUYAMA
scm: subversion: code clean up functional test....
r5441
Jean-Philippe Lang
Added some functional tests (projects and repositories)....
r968 def test_browse_directory
Toshi MARUYAMA
Rails3: scm: subversion: fix error of test_browse_directory at functional test...
r7076 assert_equal 0, @repository.changesets.count
Toshi MARUYAMA
scm: subversion: change some functional tests project id from 1 to 3....
r4776 @repository.fetch_changesets
Toshi MARUYAMA
Rails3: scm: subversion: fix error of test_browse_directory at functional test...
r7076 @project.reload
assert_equal NUM_REV, @repository.changesets.count
Toshi MARUYAMA
scm: subversion: change some functional tests project id from 1 to 3....
r4776 get :show, :id => PRJ_ID, :path => ['subversion_test']
Jean-Philippe Lang
Added some functional tests (projects and repositories)....
r968 assert_response :success
Eric Davis
Added branch and tag support to the git repository viewer. (#1406)...
r2735 assert_template 'show'
Jean-Philippe Lang
Added some functional tests (projects and repositories)....
r968 assert_not_nil assigns(:entries)
Toshi MARUYAMA
scm: subversion: code clean up test_browse_directory at functional test...
r7064 assert_equal [
'[folder_with_brackets]', 'folder', '.project',
'helloworld.c', 'textfile.txt'
],
assigns(:entries).collect(&:name)
Jean-Philippe Lang
Added some functional tests (projects and repositories)....
r968 entry = assigns(:entries).detect {|e| e.name == 'helloworld.c'}
assert_equal 'file', entry.kind
assert_equal 'subversion_test/helloworld.c', entry.path
Jean-Philippe Lang
Adds mime type specific css classes to the SCM browser....
r2580 assert_tag :a, :content => 'helloworld.c', :attributes => { :class => /text\-x\-c/ }
Jean-Philippe Lang
Added some functional tests (projects and repositories)....
r968 end
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
Rails3: scm: subversion: fix error of test_browse_at_given_revision at functional test...
r7077 assert_equal 0, @repository.changesets.count
Toshi MARUYAMA
scm: subversion: change some functional tests project id from 1 to 3....
r4776 @repository.fetch_changesets
Toshi MARUYAMA
Rails3: scm: subversion: fix error of test_browse_at_given_revision at functional test...
r7077 @project.reload
assert_equal NUM_REV, @repository.changesets.count
Toshi MARUYAMA
scm: subversion: change some functional tests project id from 1 to 3....
r4776 get :show, :id => PRJ_ID, :path => ['subversion_test'], :rev => 4
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)
Toshi MARUYAMA
scm: subversion: code clean up functional test....
r5441 assert_equal ['folder', '.project', 'helloworld.c', 'helloworld.rb', 'textfile.txt'],
assigns(:entries).collect(&:name)
Jean-Philippe Lang
Fix repository browsing at given revision for various scm and add tests for this....
r1314 end
Toshi MARUYAMA
scm: subversion: code clean up functional test....
r5441
Jean-Philippe Lang
SCM:...
r2744 def test_file_changes
Toshi MARUYAMA
Rails3: scm: subversion: fix error of test_file_changes at functional test...
r7078 assert_equal 0, @repository.changesets.count
Toshi MARUYAMA
scm: subversion: change some functional tests project id from 1 to 3....
r4776 @repository.fetch_changesets
Toshi MARUYAMA
Rails3: scm: subversion: fix error of test_file_changes at functional test...
r7078 @project.reload
assert_equal NUM_REV, @repository.changesets.count
Toshi MARUYAMA
scm: subversion: change some functional tests project id from 1 to 3....
r4776 get :changes, :id => PRJ_ID, :path => ['subversion_test', 'folder', 'helloworld.rb' ]
Jean-Philippe Lang
Display svn properties in the browser, svn >= 1.5.0 only (#1581)....
r1613 assert_response :success
assert_template 'changes'
Toshi MARUYAMA
scm: subversion: remove trailing white-spaces from functional test....
r5581
Jean-Philippe Lang
SCM:...
r2739 changesets = assigns(:changesets)
assert_not_nil changesets
assert_equal %w(6 3 2), changesets.collect(&:revision)
Toshi MARUYAMA
scm: subversion: remove trailing white-spaces from functional test....
r5581
Jean-Philippe Lang
Fixes a test failure with svn < 1.5 (#2455)....
r2247 # svn properties displayed with svn >= 1.5 only
if Redmine::Scm::Adapters::SubversionAdapter.client_version_above?([1, 5, 0])
assert_not_nil assigns(:properties)
assert_equal 'native', assigns(:properties)['svn:eol-style']
assert_tag :ul,
:child => { :tag => 'li',
:child => { :tag => 'b', :content => 'svn:eol-style' },
:child => { :tag => 'span', :content => 'native' } }
end
Jean-Philippe Lang
Display svn properties in the browser, svn >= 1.5.0 only (#1581)....
r1613 end
Jean-Philippe Lang
SCM:...
r2744
def test_directory_changes
Toshi MARUYAMA
Rails3: scm: subversion: fix error of test_directory_changes at functional test...
r7079 assert_equal 0, @repository.changesets.count
Toshi MARUYAMA
scm: subversion: change some functional tests project id from 1 to 3....
r4776 @repository.fetch_changesets
Toshi MARUYAMA
Rails3: scm: subversion: fix error of test_directory_changes at functional test...
r7079 @project.reload
assert_equal NUM_REV, @repository.changesets.count
Toshi MARUYAMA
scm: subversion: change some functional tests project id from 1 to 3....
r4776 get :changes, :id => PRJ_ID, :path => ['subversion_test', 'folder' ]
Jean-Philippe Lang
SCM:...
r2744 assert_response :success
assert_template 'changes'
Toshi MARUYAMA
scm: subversion: code clean up functional test....
r5441
Jean-Philippe Lang
SCM:...
r2744 changesets = assigns(:changesets)
assert_not_nil changesets
Jean-Philippe Lang
Fixed: RepositoriesController#revision may show wrong revision (#3779)....
r2784 assert_equal %w(10 9 7 6 5 2), changesets.collect(&:revision)
Jean-Philippe Lang
SCM:...
r2744 end
Toshi MARUYAMA
scm: subversion: code clean up functional test....
r5441
Jean-Philippe Lang
Added some functional tests (projects and repositories)....
r968 def test_entry
Toshi MARUYAMA
Rails3: scm: subversion: fix error of test_entry at functional test...
r7080 assert_equal 0, @repository.changesets.count
Toshi MARUYAMA
scm: subversion: change some functional tests project id from 1 to 3....
r4776 @repository.fetch_changesets
Toshi MARUYAMA
Rails3: scm: subversion: fix error of test_entry at functional test...
r7080 @project.reload
assert_equal NUM_REV, @repository.changesets.count
Toshi MARUYAMA
scm: subversion: change some functional tests project id from 1 to 3....
r4776 get :entry, :id => PRJ_ID, :path => ['subversion_test', 'helloworld.c']
Jean-Philippe Lang
Added some functional tests (projects and repositories)....
r968 assert_response :success
assert_template 'entry'
end
Toshi MARUYAMA
scm: subversion: code clean up functional test....
r5441
Jean-Philippe Lang
Limit the size of repository files displayed inline too....
r2442 def test_entry_should_send_if_too_big
Toshi MARUYAMA
Rails3: scm: subversion: fix error of test_entry_should_send_if_too_big at functional test...
r7081 assert_equal 0, @repository.changesets.count
Toshi MARUYAMA
scm: subversion: change some functional tests project id from 1 to 3....
r4776 @repository.fetch_changesets
Toshi MARUYAMA
Rails3: scm: subversion: fix error of test_entry_should_send_if_too_big at functional test...
r7081 @project.reload
assert_equal NUM_REV, @repository.changesets.count
Jean-Philippe Lang
Limit the size of repository files displayed inline too....
r2442 # no files in the test repo is larger than 1KB...
with_settings :file_max_size_displayed => 0 do
Toshi MARUYAMA
scm: subversion: change some functional tests project id from 1 to 3....
r4776 get :entry, :id => PRJ_ID, :path => ['subversion_test', 'helloworld.c']
Jean-Philippe Lang
Limit the size of repository files displayed inline too....
r2442 assert_response :success
assert_template ''
Toshi MARUYAMA
scm: subversion: code clean up test_entry_should_send_if_too_big at functional test...
r7065 assert_equal 'attachment; filename="helloworld.c"',
@response.headers['Content-Disposition']
Jean-Philippe Lang
Limit the size of repository files displayed inline too....
r2442 end
end
Toshi MARUYAMA
scm: subversion: code clean up functional test....
r5441
Jean-Philippe Lang
Fixed: view file at given revision with CVS....
r1539 def test_entry_at_given_revision
Toshi MARUYAMA
Rails3: scm: subversion: fix error of test_entry_at_given_revision at functional test...
r7082 assert_equal 0, @repository.changesets.count
Toshi MARUYAMA
scm: subversion: change some functional tests project id from 1 to 3....
r4776 @repository.fetch_changesets
Toshi MARUYAMA
Rails3: scm: subversion: fix error of test_entry_at_given_revision at functional test...
r7082 @project.reload
assert_equal NUM_REV, @repository.changesets.count
Toshi MARUYAMA
scm: subversion: change some functional tests project id from 1 to 3....
r4776 get :entry, :id => PRJ_ID, :path => ['subversion_test', 'helloworld.rb'], :rev => 2
Jean-Philippe Lang
Fixed: view file at given revision with CVS....
r1539 assert_response :success
assert_template 'entry'
# this line was removed in r3 and file was moved in r6
assert_tag :tag => 'td', :attributes => { :class => /line-code/},
:content => /Here's the code/
end
Toshi MARUYAMA
scm: subversion: code clean up functional test....
r5441
Jean-Philippe Lang
Fixed RepositoriesController: undefined local variable or method `show_error' (broken by r1094)....
r1090 def test_entry_not_found
Toshi MARUYAMA
Rails3: scm: subversion: fix error of test_entry_not_found at functional test...
r7083 assert_equal 0, @repository.changesets.count
Toshi MARUYAMA
scm: subversion: change some functional tests project id from 1 to 3....
r4776 @repository.fetch_changesets
Toshi MARUYAMA
Rails3: scm: subversion: fix error of test_entry_not_found at functional test...
r7083 @project.reload
assert_equal NUM_REV, @repository.changesets.count
Toshi MARUYAMA
scm: subversion: change some functional tests project id from 1 to 3....
r4776 get :entry, :id => PRJ_ID, :path => ['subversion_test', 'zzz.c']
Eric Davis
Fix the tests that were broken by r4286:...
r4175 assert_tag :tag => 'p', :attributes => { :id => /errorExplanation/ },
Jean-Philippe Lang
Always show 'View' and 'Annotate' links on repository files (download will be forced when clicking 'View' if the file is binary)....
r1259 :content => /The entry or revision was not found in the repository/
Jean-Philippe Lang
Fixed RepositoriesController: undefined local variable or method `show_error' (broken by r1094)....
r1090 end
Toshi MARUYAMA
scm: subversion: code clean up functional test....
r5441
Jean-Philippe Lang
Added some functional tests (projects and repositories)....
r968 def test_entry_download
Toshi MARUYAMA
Rails3: scm: subversion: fix error of test_entry_download at functional test...
r7084 assert_equal 0, @repository.changesets.count
Toshi MARUYAMA
scm: subversion: change some functional tests project id from 1 to 3....
r4776 @repository.fetch_changesets
Toshi MARUYAMA
Rails3: scm: subversion: fix error of test_entry_download at functional test...
r7084 @project.reload
assert_equal NUM_REV, @repository.changesets.count
Toshi MARUYAMA
scm: subversion: change some functional tests project id from 1 to 3....
r4776 get :entry, :id => PRJ_ID, :path => ['subversion_test', 'helloworld.c'], :format => 'raw'
Jean-Philippe Lang
Added some functional tests (projects and repositories)....
r968 assert_response :success
Jean-Philippe Lang
Limit the size of repository files displayed inline too....
r2442 assert_template ''
assert_equal 'attachment; filename="helloworld.c"', @response.headers['Content-Disposition']
Jean-Philippe Lang
Added some functional tests (projects and repositories)....
r968 end
Toshi MARUYAMA
scm: subversion: code clean up functional test....
r5441
Jean-Philippe Lang
Fixed: Links to repository directories don't work (#1119)....
r1350 def test_directory_entry
Toshi MARUYAMA
Rails3: scm: subversion: fix error of test_directory_entry at functional test...
r7066 assert_equal 0, @repository.changesets.count
Toshi MARUYAMA
scm: subversion: change some functional tests project id from 1 to 3....
r4776 @repository.fetch_changesets
Toshi MARUYAMA
Rails3: scm: subversion: fix error of test_directory_entry at functional test...
r7066 @project.reload
assert_equal NUM_REV, @repository.changesets.count
Toshi MARUYAMA
scm: subversion: change some functional tests project id from 1 to 3....
r4776 get :entry, :id => PRJ_ID, :path => ['subversion_test', 'folder']
Jean-Philippe Lang
Fixed: Links to repository directories don't work (#1119)....
r1350 assert_response :success
Eric Davis
Added branch and tag support to the git repository viewer. (#1406)...
r2735 assert_template 'show'
Jean-Philippe Lang
Fixed: Links to repository directories don't work (#1119)....
r1350 assert_not_nil assigns(:entry)
assert_equal 'folder', assigns(:entry).name
end
Toshi MARUYAMA
scm: subversion: code clean up functional test....
r5441
Toshi MARUYAMA
scm: subversion: change some functional tests project id from 1 to 3....
r4776 # TODO: this test needs fixtures.
Jean-Philippe Lang
Fixed: View differences for individual file of a changeset fails if the subversion repository URL doesn't point to the repository root (#1209, #1262, #1275)....
r1432 def test_revision
get :revision, :id => 1, :rev => 2
assert_response :success
assert_template 'revision'
Jean-Philippe Lang
Render the commit changes list as a tree (#1896)....
r1868 assert_tag :tag => 'ul',
:child => { :tag => 'li',
Jean-Philippe Lang
Makes changes link to entries on the revision view....
r1538 # link to the entry at rev 2
Toshi MARUYAMA
scm: subversion: remove trailing white-spaces from functional test....
r5581 :child => { :tag => 'a',
Eric Davis
Converted routing and urls to follow the Rails REST convention....
r2315 :attributes => {:href => '/projects/ecookbook/repository/revisions/2/entry/test/some/path/in/the/repo'},
Jean-Philippe Lang
Render the commit changes list as a tree (#1896)....
r1868 :content => 'repo',
# link to partial diff
Toshi MARUYAMA
scm: subversion: remove trailing white-spaces from functional test....
r5581 :sibling => { :tag => 'a',
:attributes => { :href => '/projects/ecookbook/repository/revisions/2/diff/test/some/path/in/the/repo' }
Jean-Philippe Lang
Render the commit changes list as a tree (#1896)....
r1868 }
}
}
Jean-Philippe Lang
Fixed: View differences for individual file of a changeset fails if the subversion repository URL doesn't point to the repository root (#1209, #1262, #1275)....
r1432 end
Toshi MARUYAMA
scm: subversion: code clean up functional test....
r5441
Jean-Philippe Lang
Restore rev param validation that was removed in r2840....
r4428 def test_invalid_revision
Toshi MARUYAMA
Rails3: scm: subversion: fix error of test_invalid_revision at functional test...
r7067 assert_equal 0, @repository.changesets.count
Toshi MARUYAMA
scm: subversion: change some functional tests project id from 1 to 3....
r4776 @repository.fetch_changesets
Toshi MARUYAMA
Rails3: scm: subversion: fix error of test_invalid_revision at functional test...
r7067 @project.reload
assert_equal NUM_REV, @repository.changesets.count
Toshi MARUYAMA
scm: subversion: change some functional tests project id from 1 to 3....
r4776 get :revision, :id => PRJ_ID, :rev => 'something_weird'
Jean-Philippe Lang
Respond with 404 instead of 500 when revision/entry is not found in the repository (#7307)....
r4590 assert_response 404
Jean-Philippe Lang
Restore rev param validation that was removed in r2840....
r4428 assert_error_tag :content => /was not found/
end
Toshi MARUYAMA
scm: fix error on revision page for empty revision (#7307)....
r4583
Toshi MARUYAMA
scm: fix diff revision param validation....
r4740 def test_invalid_revision_diff
Toshi MARUYAMA
scm: subversion: change some functional tests project id from 1 to 3....
r4776 get :diff, :id => PRJ_ID, :rev => '1', :rev_to => 'something_weird'
Toshi MARUYAMA
scm: fix diff revision param validation....
r4740 assert_response 404
assert_error_tag :content => /was not found/
end
Toshi MARUYAMA
scm: fix error on revision page for empty revision (#7307)....
r4583 def test_empty_revision
Toshi MARUYAMA
Rails3: scm: subversion: fix error of test_empty_revision at functional test...
r7068 assert_equal 0, @repository.changesets.count
Toshi MARUYAMA
scm: subversion: change some functional tests project id from 1 to 3....
r4776 @repository.fetch_changesets
Toshi MARUYAMA
Rails3: scm: subversion: fix error of test_empty_revision at functional test...
r7068 @project.reload
assert_equal NUM_REV, @repository.changesets.count
Toshi MARUYAMA
scm: fix error on revision page for empty revision (#7307)....
r4583 ['', ' ', nil].each do |r|
Toshi MARUYAMA
scm: subversion: change some functional tests project id from 1 to 3....
r4776 get :revision, :id => PRJ_ID, :rev => r
Jean-Philippe Lang
Respond with 404 instead of 500 when revision/entry is not found in the repository (#7307)....
r4590 assert_response 404
Toshi MARUYAMA
scm: fix error on revision page for empty revision (#7307)....
r4583 assert_error_tag :content => /was not found/
end
end
Toshi MARUYAMA
scm: subversion: change some functional tests project id from 1 to 3....
r4776 # TODO: this test needs fixtures.
Jean-Philippe Lang
Fixed: View differences for individual file of a changeset fails if the subversion repository URL doesn't point to the repository root (#1209, #1262, #1275)....
r1432 def test_revision_with_repository_pointing_to_a_subdirectory
r = Project.find(1).repository
# Changes repository url to a subdirectory
r.update_attribute :url, (r.url + '/test/some')
Toshi MARUYAMA
scm: subversion: code clean up functional test....
r5441
Jean-Philippe Lang
Fixed: View differences for individual file of a changeset fails if the subversion repository URL doesn't point to the repository root (#1209, #1262, #1275)....
r1432 get :revision, :id => 1, :rev => 2
assert_response :success
assert_template 'revision'
Jean-Philippe Lang
Render the commit changes list as a tree (#1896)....
r1868 assert_tag :tag => 'ul',
:child => { :tag => 'li',
# link to the entry at rev 2
Toshi MARUYAMA
scm: subversion: remove trailing white-spaces from functional test....
r5581 :child => { :tag => 'a',
Eric Davis
Converted routing and urls to follow the Rails REST convention....
r2315 :attributes => {:href => '/projects/ecookbook/repository/revisions/2/entry/path/in/the/repo'},
Jean-Philippe Lang
Render the commit changes list as a tree (#1896)....
r1868 :content => 'repo',
# link to partial diff
Toshi MARUYAMA
scm: subversion: remove trailing white-spaces from functional test....
r5581 :sibling => { :tag => 'a',
:attributes => { :href => '/projects/ecookbook/repository/revisions/2/diff/path/in/the/repo' }
Jean-Philippe Lang
Render the commit changes list as a tree (#1896)....
r1868 }
}
}
Jean-Philippe Lang
Fixed: View differences for individual file of a changeset fails if the subversion repository URL doesn't point to the repository root (#1209, #1262, #1275)....
r1432 end
Toshi MARUYAMA
scm: subversion: code clean up functional test....
r5441
Jean-Philippe Lang
SCM:...
r2744 def test_revision_diff
Toshi MARUYAMA
Rails3: scm: subversion: fix error of test_revision_diff at functional test...
r7069 assert_equal 0, @repository.changesets.count
Toshi MARUYAMA
scm: subversion: change some functional tests project id from 1 to 3....
r4776 @repository.fetch_changesets
Toshi MARUYAMA
Rails3: scm: subversion: fix error of test_revision_diff at functional test...
r7069 @project.reload
assert_equal NUM_REV, @repository.changesets.count
Toshi MARUYAMA
scm: subversion: run both of "inline" and "side by side" diff in functional test_revision_diff test....
r5861 ['inline', 'sbs'].each do |dt|
get :diff, :id => PRJ_ID, :rev => 3, :type => dt
assert_response :success
assert_template 'diff'
assert_tag :tag => 'h2',
:content => / 3/
end
Jean-Philippe Lang
Added some functional tests (projects and repositories)....
r968 end
Jean-Philippe Lang
SCM:...
r2744
def test_directory_diff
Toshi MARUYAMA
Rails3: scm: subversion: fix error of test_directory_diff at functional test...
r7070 assert_equal 0, @repository.changesets.count
Toshi MARUYAMA
scm: subversion: change some functional tests project id from 1 to 3....
r4776 @repository.fetch_changesets
Toshi MARUYAMA
Rails3: scm: subversion: fix error of test_directory_diff at functional test...
r7070 @project.reload
assert_equal NUM_REV, @repository.changesets.count
Toshi MARUYAMA
scm: subversion: run both of "inline" and "side by side" diff in functional test_directory_diff test....
r5862 ['inline', 'sbs'].each do |dt|
get :diff, :id => PRJ_ID, :rev => 6, :rev_to => 2,
:path => ['subversion_test', 'folder'], :type => dt
assert_response :success
assert_template 'diff'
Toshi MARUYAMA
scm: add compatible functional test fof changing diff revisions label at SCM adapter level....
r4545
Toshi MARUYAMA
scm: subversion: run both of "inline" and "side by side" diff in functional test_directory_diff test....
r5862 diff = assigns(:diff)
assert_not_nil diff
# 2 files modified
assert_equal 2, Redmine::UnifiedDiff.new(diff).size
assert_tag :tag => 'h2', :content => /2:6/
end
Jean-Philippe Lang
SCM:...
r2744 end
Toshi MARUYAMA
scm: subversion: code clean up functional test....
r5441
Jean-Philippe Lang
Added some functional tests (projects and repositories)....
r968 def test_annotate
Toshi MARUYAMA
Rails3: scm: subversion: fix error of test_annotate at functional test...
r7071 assert_equal 0, @repository.changesets.count
Toshi MARUYAMA
scm: subversion: change some functional tests project id from 1 to 3....
r4776 @repository.fetch_changesets
Toshi MARUYAMA
Rails3: scm: subversion: fix error of test_annotate at functional test...
r7071 @project.reload
assert_equal NUM_REV, @repository.changesets.count
Toshi MARUYAMA
scm: subversion: change some functional tests project id from 1 to 3....
r4776 get :annotate, :id => PRJ_ID, :path => ['subversion_test', 'helloworld.c']
Jean-Philippe Lang
Added some functional tests (projects and repositories)....
r968 assert_response :success
assert_template 'annotate'
end
Toshi MARUYAMA
scm: functional test of using format_revision() for annotate (#3724)....
r4614
def test_annotate_at_given_revision
Toshi MARUYAMA
Rails3: scm: subversion: fix error of test_annotate_at_given_revision at functional test...
r7072 assert_equal 0, @repository.changesets.count
Toshi MARUYAMA
scm: subversion: change some functional tests project id from 1 to 3....
r4776 @repository.fetch_changesets
Toshi MARUYAMA
Rails3: scm: subversion: fix error of test_annotate_at_given_revision at functional test...
r7072 @project.reload
assert_equal NUM_REV, @repository.changesets.count
Toshi MARUYAMA
scm: subversion: change some functional tests project id from 1 to 3....
r4776 get :annotate, :id => PRJ_ID, :rev => 8, :path => ['subversion_test', 'helloworld.c']
Toshi MARUYAMA
scm: functional test of using format_revision() for annotate (#3724)....
r4614 assert_response :success
assert_template 'annotate'
assert_tag :tag => 'h2', :content => /@ 8/
end
Toshi MARUYAMA
scm: subversion: add functional test of destroying valid repository (#8458, #6713, #4725)....
r6104
def test_destroy_valid_repository
@request.session[:user_id] = 1 # admin
Toshi MARUYAMA
Rails3: scm: subversion: fix error of test_destroy_valid_repository at functional test...
r7073 assert_equal 0, @repository.changesets.count
Toshi MARUYAMA
scm: subversion: add functional test of destroying valid repository (#8458, #6713, #4725)....
r6104 @repository.fetch_changesets
Toshi MARUYAMA
Rails3: scm: subversion: fix error of test_destroy_valid_repository at functional test...
r7073 @project.reload
assert_equal NUM_REV, @repository.changesets.count
Toshi MARUYAMA
scm: subversion: add functional test of destroying valid repository (#8458, #6713, #4725)....
r6104
get :destroy, :id => PRJ_ID
assert_response 302
@project.reload
assert_nil @project.repository
end
Toshi MARUYAMA
scm: subversion: add functional test of destroying invalid repository (#8458, #6713, #4725)....
r6105 def test_destroy_invalid_repository
@request.session[:user_id] = 1 # admin
Toshi MARUYAMA
Rails3: scm: subversion: fix error of test_destroy_invalid_repository at functional test...
r7074 assert_equal 0, @repository.changesets.count
Toshi MARUYAMA
scm: subversion: add functional test of destroying invalid repository (#8458, #6713, #4725)....
r6105 @repository.fetch_changesets
Toshi MARUYAMA
Rails3: scm: subversion: fix error of test_destroy_invalid_repository at functional test...
r7074 @project.reload
assert_equal NUM_REV, @repository.changesets.count
Toshi MARUYAMA
scm: subversion: add functional test of destroying invalid repository (#8458, #6713, #4725)....
r6105
get :destroy, :id => PRJ_ID
assert_response 302
@project.reload
assert_nil @project.repository
Toshi MARUYAMA
scm: subversion: code clean up functional test....
r6111 @repository = Repository::Subversion.create(
:project => @project,
:url => "file:///invalid")
Toshi MARUYAMA
scm: subversion: add functional test of destroying invalid repository (#8458, #6713, #4725)....
r6105 assert @repository
@repository.fetch_changesets
Toshi MARUYAMA
Rails3: scm: subversion: fix error of test_destroy_invalid_repository at functional test...
r7074 @project.reload
Toshi MARUYAMA
scm: subversion: add functional test of destroying invalid repository (#8458, #6713, #4725)....
r6105 assert_equal 0, @repository.changesets.count
get :destroy, :id => PRJ_ID
assert_response 302
@project.reload
assert_nil @project.repository
end
Jean-Philippe Lang
Added some functional tests (projects and repositories)....
r968 else
puts "Subversion test repository NOT FOUND. Skipping functional tests !!!"
def test_fake; assert true end
end
end