Mercurial > hg > soundsoftware-site
comparison test/functional/settings_controller_test.rb @ 1115:433d4f72a19b redmine-2.2
Update to Redmine SVN revision 11137 on 2.2-stable branch
author | Chris Cannam |
---|---|
date | Mon, 07 Jan 2013 12:01:42 +0000 |
parents | cbb26bc654de |
children | 622f24f53b42 261b3d9a4903 |
comparison
equal
deleted
inserted
replaced
929:5f33065ddc4b | 1115:433d4f72a19b |
---|---|
1 # Redmine - project management software | 1 # Redmine - project management software |
2 # Copyright (C) 2006-2011 Jean-Philippe Lang | 2 # Copyright (C) 2006-2012 Jean-Philippe Lang |
3 # | 3 # |
4 # This program is free software; you can redistribute it and/or | 4 # This program is free software; you can redistribute it and/or |
5 # modify it under the terms of the GNU General Public License | 5 # modify it under the terms of the GNU General Public License |
6 # as published by the Free Software Foundation; either version 2 | 6 # as published by the Free Software Foundation; either version 2 |
7 # of the License, or (at your option) any later version. | 7 # of the License, or (at your option) any later version. |
44 assert_template 'edit' | 44 assert_template 'edit' |
45 | 45 |
46 assert_tag 'input', :attributes => {:name => 'settings[enabled_scm][]', :value => ''} | 46 assert_tag 'input', :attributes => {:name => 'settings[enabled_scm][]', :value => ''} |
47 end | 47 end |
48 | 48 |
49 def test_get_edit_should_preselect_default_issue_list_columns | |
50 with_settings :issue_list_default_columns => %w(tracker subject status updated_on) do | |
51 get :edit | |
52 assert_response :success | |
53 end | |
54 | |
55 assert_select 'select[id=selected_columns][name=?]', 'settings[issue_list_default_columns][]' do | |
56 assert_select 'option', 4 | |
57 assert_select 'option[value=tracker]', :text => 'Tracker' | |
58 assert_select 'option[value=subject]', :text => 'Subject' | |
59 assert_select 'option[value=status]', :text => 'Status' | |
60 assert_select 'option[value=updated_on]', :text => 'Updated' | |
61 end | |
62 | |
63 assert_select 'select[id=available_columns]' do | |
64 assert_select 'option[value=tracker]', 0 | |
65 assert_select 'option[value=priority]', :text => 'Priority' | |
66 end | |
67 end | |
68 | |
69 def test_get_edit_without_trackers_should_succeed | |
70 Tracker.delete_all | |
71 | |
72 get :edit | |
73 assert_response :success | |
74 end | |
75 | |
49 def test_post_edit_notifications | 76 def test_post_edit_notifications |
50 post :edit, :settings => {:mail_from => 'functional@test.foo', | 77 post :edit, :settings => {:mail_from => 'functional@test.foo', |
51 :bcc_recipients => '0', | 78 :bcc_recipients => '0', |
52 :notified_events => %w(issue_added issue_updated news_added), | 79 :notified_events => %w(issue_added issue_updated news_added), |
53 :emails_footer => 'Test footer' | 80 :emails_footer => 'Test footer' |
55 assert_redirected_to '/settings/edit' | 82 assert_redirected_to '/settings/edit' |
56 assert_equal 'functional@test.foo', Setting.mail_from | 83 assert_equal 'functional@test.foo', Setting.mail_from |
57 assert !Setting.bcc_recipients? | 84 assert !Setting.bcc_recipients? |
58 assert_equal %w(issue_added issue_updated news_added), Setting.notified_events | 85 assert_equal %w(issue_added issue_updated news_added), Setting.notified_events |
59 assert_equal 'Test footer', Setting.emails_footer | 86 assert_equal 'Test footer', Setting.emails_footer |
87 Setting.clear_cache | |
88 end | |
89 | |
90 def test_get_plugin_settings | |
91 Setting.stubs(:plugin_foo).returns({'sample_setting' => 'Plugin setting value'}) | |
92 ActionController::Base.append_view_path(File.join(Rails.root, "test/fixtures/plugins")) | |
93 Redmine::Plugin.register :foo do | |
94 settings :partial => "foo_plugin/foo_plugin_settings" | |
95 end | |
96 | |
97 get :plugin, :id => 'foo' | |
98 assert_response :success | |
99 assert_template 'plugin' | |
100 assert_tag 'form', :attributes => {:action => '/settings/plugin/foo'}, | |
101 :descendant => {:tag => 'input', :attributes => {:name => 'settings[sample_setting]', :value => 'Plugin setting value'}} | |
102 | |
103 Redmine::Plugin.clear | |
104 end | |
105 | |
106 def test_get_invalid_plugin_settings | |
107 get :plugin, :id => 'none' | |
108 assert_response 404 | |
109 end | |
110 | |
111 def test_post_plugin_settings | |
112 Setting.expects(:plugin_foo=).with({'sample_setting' => 'Value'}).returns(true) | |
113 Redmine::Plugin.register(:foo) {} | |
114 | |
115 post :plugin, :id => 'foo', :settings => {'sample_setting' => 'Value'} | |
116 assert_redirected_to '/settings/plugin/foo' | |
60 end | 117 end |
61 end | 118 end |