scm: mercurial: add instance value flag of whether "hg diff -c" supports at tests (#7518).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4853 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
700577c533
commit
671b16f898
|
@ -34,6 +34,7 @@ class RepositoriesMercurialControllerTest < ActionController::TestCase
|
||||||
User.current = nil
|
User.current = nil
|
||||||
@repository = Repository::Mercurial.create(:project => Project.find(3), :url => REPOSITORY_PATH)
|
@repository = Repository::Mercurial.create(:project => Project.find(3), :url => REPOSITORY_PATH)
|
||||||
assert @repository
|
assert @repository
|
||||||
|
@diff_c_support = @repository.scm.class.client_version_above?([1, 2])
|
||||||
end
|
end
|
||||||
|
|
||||||
if File.directory?(REPOSITORY_PATH)
|
if File.directory?(REPOSITORY_PATH)
|
||||||
|
@ -137,7 +138,7 @@ class RepositoriesMercurialControllerTest < ActionController::TestCase
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_template 'diff'
|
assert_template 'diff'
|
||||||
|
|
||||||
if @repository.scm.class.client_version_above?([1, 2])
|
if @diff_c_support
|
||||||
# Line 22 removed
|
# Line 22 removed
|
||||||
assert_tag :tag => 'th',
|
assert_tag :tag => 'th',
|
||||||
:content => '22',
|
:content => '22',
|
||||||
|
|
|
@ -13,6 +13,7 @@ begin
|
||||||
if File.directory?(REPOSITORY_PATH)
|
if File.directory?(REPOSITORY_PATH)
|
||||||
def setup
|
def setup
|
||||||
@adapter = Redmine::Scm::Adapters::MercurialAdapter.new(REPOSITORY_PATH)
|
@adapter = Redmine::Scm::Adapters::MercurialAdapter.new(REPOSITORY_PATH)
|
||||||
|
@diff_c_support = @adapter.class.client_version_above?([1, 2])
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_hgversion
|
def test_hgversion
|
||||||
|
@ -73,7 +74,7 @@ begin
|
||||||
assert_nil @adapter.diff(nil, '100000', '200000')
|
assert_nil @adapter.diff(nil, '100000', '200000')
|
||||||
[2, '400bb8672109', '400', 400].each do |r1|
|
[2, '400bb8672109', '400', 400].each do |r1|
|
||||||
diff1 = @adapter.diff(nil, r1)
|
diff1 = @adapter.diff(nil, r1)
|
||||||
if @adapter.class.client_version_above?([1, 2])
|
if @diff_c_support
|
||||||
assert_equal 28, diff1.size
|
assert_equal 28, diff1.size
|
||||||
buf = diff1[24].gsub(/\r\n|\r|\n/, "")
|
buf = diff1[24].gsub(/\r\n|\r|\n/, "")
|
||||||
assert_equal "+ return true unless klass.respond_to?('watched_by')", buf
|
assert_equal "+ return true unless klass.respond_to?('watched_by')", buf
|
||||||
|
@ -94,7 +95,7 @@ begin
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_diff_made_by_revision
|
def test_diff_made_by_revision
|
||||||
if @adapter.class.client_version_above?([1, 2])
|
if @diff_c_support
|
||||||
[16, '16', '4cddb4e45f52'].each do |r1|
|
[16, '16', '4cddb4e45f52'].each do |r1|
|
||||||
diff1 = @adapter.diff(nil, r1)
|
diff1 = @adapter.diff(nil, r1)
|
||||||
assert_equal 5, diff1.size
|
assert_equal 5, diff1.size
|
||||||
|
|
Loading…
Reference in New Issue