diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2013-10-05 09:41:11 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2013-10-05 09:41:11 +0000 |
commit | a77b462a53a02dbead1042bd12060177ade7b22a (patch) | |
tree | 4d58c8dee5c021a8dd1af32a8fbe741e3c6ea1d0 /test/functional/settings_controller_test.rb | |
parent | b59d10968036b7da57a499895a9a2d91ea227c34 (diff) | |
download | redmine-a77b462a53a02dbead1042bd12060177ade7b22a.tar.gz redmine-a77b462a53a02dbead1042bd12060177ade7b22a.zip |
Support for multiple issue update keywords/rules in commit messages (#4911).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@12197 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional/settings_controller_test.rb')
-rw-r--r-- | test/functional/settings_controller_test.rb | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/test/functional/settings_controller_test.rb b/test/functional/settings_controller_test.rb index df4abd6b7..57dd629b2 100644 --- a/test/functional/settings_controller_test.rb +++ b/test/functional/settings_controller_test.rb @@ -80,6 +80,57 @@ class SettingsControllerTest < ActionController::TestCase Setting.clear_cache 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 + get :edit + end + assert_response :success + assert_select 'tr.commit-keywords', 2 + 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: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]' + end + assert_select 'select[name=?]', 'settings[commit_update_keywords][done_ratio][]' do + assert_select 'option[value=100][selected=selected]' + end + end + end + + def test_edit_without_commit_update_keywords_should_show_blank_line + 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][]', '' + end + end + + def test_post_edit_commit_update_keywords + post :edit, :settings => { + :commit_update_keywords => { + :keywords => ["resolves", "closes"], + :status_id => ["3", "5"], + :done_ratio => ["", "100"] + } + } + assert_redirected_to '/settings' + assert_equal({ + "resolves" => {"status_id" => "3"}, + "closes" => {"status_id" => "5", "done_ratio" => "100"} + }, Setting.commit_update_keywords) + end + def test_get_plugin_settings Setting.stubs(:plugin_foo).returns({'sample_setting' => 'Plugin setting value'}) ActionController::Base.append_view_path(File.join(Rails.root, "test/fixtures/plugins")) |