Don't use a disabled SCM as a default repository SCM (#779).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8653 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
cba13a21e9
commit
abc0b0ea3e
|
@ -36,7 +36,7 @@ class RepositoriesController < ApplicationController
|
|||
rescue_from Redmine::Scm::Adapters::CommandFailed, :with => :show_error_command_failed
|
||||
|
||||
def new
|
||||
scm = params[:repository_scm] || Redmine::Scm::Base.all.first
|
||||
scm = params[:repository_scm] || (Redmine::Scm::Base.all & Setting.enabled_scm).first
|
||||
@repository = Repository.factory(scm)
|
||||
@repository.is_default = @project.repository.nil?
|
||||
@repository.project = @project
|
||||
|
|
|
@ -43,6 +43,22 @@ class RepositoriesControllerTest < ActionController::TestCase
|
|||
assert_tag 'input', :attributes => {:name => 'repository[url]'}
|
||||
end
|
||||
|
||||
def test_new_should_propose_enabled_scm_only
|
||||
@request.session[:user_id] = 1
|
||||
with_settings :enabled_scm => ['Mercurial', 'Git'] do
|
||||
get :new, :project_id => 'subproject1'
|
||||
end
|
||||
assert_response :success
|
||||
assert_template 'new'
|
||||
assert_kind_of Repository::Mercurial, assigns(:repository)
|
||||
assert_tag 'select', :attributes => {:name => 'repository_scm'},
|
||||
:children => {:count => 3}
|
||||
assert_tag 'select', :attributes => {:name => 'repository_scm'},
|
||||
:child => {:tag => 'option', :attributes => {:value => 'Mercurial', :selected => 'selected'}}
|
||||
assert_tag 'select', :attributes => {:name => 'repository_scm'},
|
||||
:child => {:tag => 'option', :attributes => {:value => 'Git', :selected => nil}}
|
||||
end
|
||||
|
||||
def test_create
|
||||
@request.session[:user_id] = 1
|
||||
assert_difference 'Repository.count' do
|
||||
|
|
Loading…
Reference in New Issue