From e1013c44a3b702a74349c1bc12c86158fe2fdfd9 Mon Sep 17 00:00:00 2001 From: Eric Davis Date: Mon, 21 Dec 2009 02:24:49 +0000 Subject: 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 --- test/functional/my_controller_test.rb | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'test') 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 -- cgit v1.2.3