summaryrefslogtreecommitdiffstats
path: root/test/functional/my_controller_test.rb
diff options
context:
space:
mode:
authorEric Davis <edavis@littlestreamsoftware.com>2009-12-21 02:24:49 +0000
committerEric Davis <edavis@littlestreamsoftware.com>2009-12-21 02:24:49 +0000
commite1013c44a3b702a74349c1bc12c86158fe2fdfd9 (patch)
tree1d78ec9f1e119ddf17c095fe36b53e72fb181e08 /test/functional/my_controller_test.rb
parentc478fa7f907ea8a0df118dfedfc26f4c1a6d886d (diff)
downloadredmine-e1013c44a3b702a74349c1bc12c86158fe2fdfd9.tar.gz
redmine-e1013c44a3b702a74349c1bc12c86158fe2fdfd9.zip
Make sure the RSS token is getting destroyed and created.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3210 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional/my_controller_test.rb')
-rw-r--r--test/functional/my_controller_test.rb34
1 files changed, 34 insertions, 0 deletions
diff --git a/test/functional/my_controller_test.rb b/test/functional/my_controller_test.rb
index ef12d7864..b87180745 100644
--- a/test/functional/my_controller_test.rb
+++ b/test/functional/my_controller_test.rb
@@ -129,4 +129,38 @@ class MyControllerTest < ActionController::TestCase
assert_response :success
assert_equal ['documents', 'calendar', 'latestnews'], User.find(2).pref[:my_page_layout]['left']
end
+
+ context "POST to reset_rss_key" do
+ context "with an existing rss_token" do
+ setup do
+ @previous_token_value = User.find(2).rss_key # Will generate one if it's missing
+ post :reset_rss_key
+ end
+
+ should "destroy the existing token" do
+ assert_not_equal @previous_token_value, User.find(2).rss_key
+ end
+
+ should "create a new token" do
+ assert User.find(2).rss_token
+ end
+
+ should_set_the_flash_to /reset/
+ should_redirect_to('my account') {'/my/account' }
+ end
+
+ context "with no rss_token" do
+ setup do
+ assert_nil User.find(2).rss_token
+ post :reset_rss_key
+ end
+
+ should "create a new token" do
+ assert User.find(2).rss_token
+ end
+
+ should_set_the_flash_to /reset/
+ should_redirect_to('my account') {'/my/account' }
+ end
+ end
end