summaryrefslogtreecommitdiffstats
path: root/test/functional/settings_controller_test.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2011-12-03 10:06:41 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2011-12-03 10:06:41 +0000
commitfd18c519387dcf9676f6f65fce2e2be68473d494 (patch)
treed10080d153244c2e021196b937db2bf4d190cd05 /test/functional/settings_controller_test.rb
parent8bbb5d9686fb5e3d7c00e097f9cbcff17cb22c1a (diff)
downloadredmine-fd18c519387dcf9676f6f65fce2e2be68473d494.tar.gz
redmine-fd18c519387dcf9676f6f65fce2e2be68473d494.zip
Adds tests for plugin settings editing.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8039 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional/settings_controller_test.rb')
-rw-r--r--test/functional/settings_controller_test.rb29
1 files changed, 29 insertions, 0 deletions
diff --git a/test/functional/settings_controller_test.rb b/test/functional/settings_controller_test.rb
index 13a0bcca2..fb9bb6286 100644
--- a/test/functional/settings_controller_test.rb
+++ b/test/functional/settings_controller_test.rb
@@ -56,4 +56,33 @@ class SettingsControllerTest < ActionController::TestCase
assert_equal %w(issue_added issue_updated news_added), Setting.notified_events
assert_equal 'Test footer', Setting.emails_footer
end
+
+ def test_get_plugin_settings
+ Setting.stubs(:plugin_foo).returns({'sample_setting' => 'Plugin setting value'})
+ ActionController::Base.view_paths.unshift(File.join(Rails.root, "test/fixtures/plugins"))
+ Redmine::Plugin.register :foo do
+ settings :partial => "foo_plugin/foo_plugin_settings"
+ end
+
+ get :plugin, :id => 'foo'
+ assert_response :success
+ assert_template 'plugin'
+ assert_tag 'form', :attributes => {:action => '/settings/plugin/foo'},
+ :descendant => {:tag => 'input', :attributes => {:name => 'settings[sample_setting]', :value => 'Plugin setting value'}}
+
+ Redmine::Plugin.clear
+ end
+
+ def test_get_invalid_plugin_settings
+ get :plugin, :id => 'none'
+ assert_response 404
+ end
+
+ def test_post_plugin_settings
+ Setting.expects(:plugin_foo=).with({'sample_setting' => 'Value'}).returns(true)
+ Redmine::Plugin.register(:foo) {}
+
+ post :plugin, :id => 'foo', :settings => {'sample_setting' => 'Value'}
+ assert_redirected_to '/settings/plugin/foo'
+ end
end