summaryrefslogtreecommitdiffstats
path: root/test/unit
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2012-04-15 15:34:14 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2012-04-15 15:34:14 +0000
commit24c361eb0a122e4a86621879539a067cea068a12 (patch)
tree1eb7ca6b7805ff35e5feb8bfbccab411a77330a3 /test/unit
parent9817e1d744eccc1f715564015cde80672906ba3e (diff)
downloadredmine-24c361eb0a122e4a86621879539a067cea068a12.tar.gz
redmine-24c361eb0a122e4a86621879539a067cea068a12.zip
Fixed that rss key is generated twice when user is not reloaded (#10668).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9419 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/user_test.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/unit/user_test.rb b/test/unit/user_test.rb
index 607f23770..a85d56adb 100644
--- a/test/unit/user_test.rb
+++ b/test/unit/user_test.rb
@@ -585,6 +585,22 @@ class UserTest < ActiveSupport::TestCase
assert_equal key, @jsmith.rss_key
end
+ def test_rss_key_should_not_be_generated_twice
+ assert_difference 'Token.count', 1 do
+ key1 = @jsmith.rss_key
+ key2 = @jsmith.rss_key
+ assert_equal key1, key2
+ end
+ end
+
+ def test_api_key_should_not_be_generated_twice
+ assert_difference 'Token.count', 1 do
+ key1 = @jsmith.api_key
+ key2 = @jsmith.api_key
+ assert_equal key1, key2
+ end
+ end
+
context "User#api_key" do
should "generate a new one if the user doesn't have one" do
user = User.generate_with_protected!(:api_token => nil)