]> source.dussan.org Git - redmine.git/commitdiff
1.4-stable: scm: git: backport creating and updating test from trunk r9616 (#10830)
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Wed, 6 Jun 2012 23:08:29 +0000 (23:08 +0000)
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Wed, 6 Jun 2012 23:08:29 +0000 (23:08 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.4-stable@9775 e93f8b46-1217-0410-a6f0-8f06a7374b81

test/functional/repositories_git_controller_test.rb

index da82f9026f2d49f61105a93a3d20cb02da6d87c9..860d436fecbe6185ca419ad23f0488ff1c0d1dc2 100644 (file)
@@ -57,6 +57,35 @@ class RepositoriesGitControllerTest < ActionController::TestCase
     Setting.default_language = 'en'
   end
 
+  def test_create_and_update
+    @request.session[:user_id] = 1
+    assert_difference 'Repository.count' do
+      post :create, :project_id => 'subproject1',
+                    :repository_scm => 'Git',
+                    :repository => {
+                       :url => '/test',
+                       :is_default => '0',
+                       :identifier => 'test-create',
+                       :extra_report_last_commit => '1',
+                     }
+    end
+    assert_response 302
+    repository = Repository.first(:order => 'id DESC')
+    assert_kind_of Repository::Git, repository
+    assert_equal '/test', repository.url
+    assert_equal true, repository.extra_report_last_commit
+
+    put :update, :id => repository.id,
+                 :repository => {
+                     :extra_report_last_commit => '0',
+                     :identifier => 'test-update',
+                 }
+    assert_response 302
+    repo2 = Repository.find(repository.id)
+    assert_equal 'test-update', repo2.identifier
+    assert_equal false, repo2.extra_report_last_commit
+  end
+
   if File.directory?(REPOSITORY_PATH)
     def test_get_new
       @request.session[:user_id] = 1