Ability to define commit keywords per tracker (#7590).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@12208 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -81,38 +81,41 @@ class SettingsControllerTest < ActionController::TestCase
|
||||
end
|
||||
|
||||
def test_edit_commit_update_keywords
|
||||
with_settings :commit_update_keywords => {
|
||||
"fixes, resolves" => {"status_id" => "3"},
|
||||
"closes" => {"status_id" => "5", "done_ratio" => "100"}
|
||||
} do
|
||||
with_settings :commit_update_keywords => [
|
||||
{"keywords" => "fixes, resolves", "status_id" => "3"},
|
||||
{"keywords" => "closes", "status_id" => "5", "done_ratio" => "100", "if_tracker_id" => "2"}
|
||||
] do
|
||||
get :edit
|
||||
end
|
||||
assert_response :success
|
||||
assert_select 'tr.commit-keywords', 2
|
||||
assert_select 'tr.commit-keywords' do
|
||||
assert_select 'tr.commit-keywords:nth-child(1)' do
|
||||
assert_select 'input[name=?][value=?]', 'settings[commit_update_keywords][keywords][]', 'fixes, resolves'
|
||||
assert_select 'select[name=?]', 'settings[commit_update_keywords][status_id][]' do
|
||||
assert_select 'option[value=3][selected=selected]'
|
||||
end
|
||||
end
|
||||
assert_select 'tr.commit-keywords' do
|
||||
assert_select 'tr.commit-keywords:nth-child(2)' do
|
||||
assert_select 'input[name=?][value=?]', 'settings[commit_update_keywords][keywords][]', 'closes'
|
||||
assert_select 'select[name=?]', 'settings[commit_update_keywords][status_id][]' do
|
||||
assert_select 'option[value=5][selected=selected]'
|
||||
assert_select 'option[value=5][selected=selected]', :text => 'Closed'
|
||||
end
|
||||
assert_select 'select[name=?]', 'settings[commit_update_keywords][done_ratio][]' do
|
||||
assert_select 'option[value=100][selected=selected]'
|
||||
assert_select 'option[value=100][selected=selected]', :text => '100 %'
|
||||
end
|
||||
assert_select 'select[name=?]', 'settings[commit_update_keywords][if_tracker_id][]' do
|
||||
assert_select 'option[value=2][selected=selected]', :text => 'Feature request'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def test_edit_without_commit_update_keywords_should_show_blank_line
|
||||
with_settings :commit_update_keywords => {} do
|
||||
with_settings :commit_update_keywords => [] do
|
||||
get :edit
|
||||
end
|
||||
assert_response :success
|
||||
assert_select 'tr.commit-keywords', 1 do
|
||||
assert_select 'input[name=?][value=?]', 'settings[commit_update_keywords][keywords][]', ''
|
||||
assert_select 'input[name=?]:not([value])', 'settings[commit_update_keywords][keywords][]'
|
||||
end
|
||||
end
|
||||
|
||||
@@ -121,14 +124,15 @@ class SettingsControllerTest < ActionController::TestCase
|
||||
:commit_update_keywords => {
|
||||
:keywords => ["resolves", "closes"],
|
||||
:status_id => ["3", "5"],
|
||||
:done_ratio => ["", "100"]
|
||||
:done_ratio => ["", "100"],
|
||||
:if_tracker_id => ["", "2"]
|
||||
}
|
||||
}
|
||||
assert_redirected_to '/settings'
|
||||
assert_equal({
|
||||
"resolves" => {"status_id" => "3"},
|
||||
"closes" => {"status_id" => "5", "done_ratio" => "100"}
|
||||
}, Setting.commit_update_keywords)
|
||||
assert_equal([
|
||||
{"keywords" => "resolves", "status_id" => "3"},
|
||||
{"keywords" => "closes", "status_id" => "5", "done_ratio" => "100", "if_tracker_id" => "2"}
|
||||
], Setting.commit_update_keywords)
|
||||
end
|
||||
|
||||
def test_get_plugin_settings
|
||||
|
||||
Reference in New Issue
Block a user