]> source.dussan.org Git - redmine.git/commitdiff
Use MiniTest::Assertions#skip to skip tests in RepositoriesControllerTest when Subver...
authorGo MAEDA <maeda@farend.jp>
Thu, 11 Mar 2021 08:05:29 +0000 (08:05 +0000)
committerGo MAEDA <maeda@farend.jp>
Thu, 11 Mar 2021 08:05:29 +0000 (08:05 +0000)
git-svn-id: http://svn.redmine.org/redmine/trunk@20774 e93f8b46-1217-0410-a6f0-8f06a7374b81

test/functional/repositories_controller_test.rb
test/test_helper.rb

index 4f20670267e09d7627cc209469f2ab5acb56fb07..f2e3fae4e977d4b26da4b3448437e72e82c89d82 100644 (file)
@@ -188,37 +188,39 @@ class RepositoriesControllerTest < Redmine::RepositoryControllerTest
     end
   end
 
-  if repository_configured?('subversion')
-    def test_show_should_show_diff_button_depending_on_browse_repository_permission
-      @request.session[:user_id] = 2
-      role = Role.find(1)
+  def test_show_should_show_diff_button_depending_on_browse_repository_permission
+    skip unless repository_configured?('subversion')
 
-      role.add_permission! :browse_repository
-      get(:show, :params => {:id => 1})
-      assert_response :success
-      assert_select 'input[value="View differences"]'
+    @request.session[:user_id] = 2
+    role = Role.find(1)
 
-      role.remove_permission! :browse_repository
-      get(:show, :params => {:id => 1})
+    role.add_permission! :browse_repository
+    get(:show, :params => {:id => 1})
+    assert_response :success
+    assert_select 'input[value="View differences"]'
+
+    role.remove_permission! :browse_repository
+    get(:show, :params => {:id => 1})
+    assert_response :success
+    assert_select 'input[value="View differences"]', :count => 0
+  end
+
+  def test_fetch_changesets
+    skip unless repository_configured?('subversion')
+
+    @request.session[:user_id] = 2
+    role = Role.find(1)
+
+    with_settings :autofetch_changesets => '0' do
+      role.add_permission! :manage_repository
+      Repository::Subversion.any_instance.expects(:fetch_changesets).once
+      post(:fetch_changesets, :params => {:id => 1, :repository_id => 10})
       assert_response :success
-      assert_select 'input[value="View differences"]', :count => 0
-    end
 
-    def test_fetch_changesets
-      @request.session[:user_id] = 2
-      role = Role.find(1)
-
-      with_settings :autofetch_changesets => '0' do
-        role.add_permission! :manage_repository
-        Repository::Subversion.any_instance.expects(:fetch_changesets).once
-        post(:fetch_changesets, :params => {:id => 1, :repository_id => 10})
-        assert_response :success
-
-        role.remove_permission! :manage_repository
-        Repository::Subversion.any_instance.expects(:fetch_changesets).never
-        post(:fetch_changesets, :params => {:id => 1, :repository_id => 10})
-        assert_response :forbidden
-      end
+      role.remove_permission! :manage_repository
+      Repository::Subversion.any_instance.expects(:fetch_changesets).never
+      post(:fetch_changesets, :params => {:id => 1, :repository_id => 10})
+      assert_response :forbidden
     end
   end
 
index 94f62d9fc25d47e9bc837e668708f5987b829479..86801ff54cd745dc8004e21c823a019e3f63e8d4 100644 (file)
@@ -163,6 +163,10 @@ class ActiveSupport::TestCase
     File.directory?(repository_path(vendor))
   end
 
+  def repository_configured?(vendor)
+    self.class.repository_configured?(vendor)
+  end
+
   def self.is_mysql_utf8mb4
     return false unless Redmine::Database.mysql?