Merged r9419 from trunk.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.4-stable@9435 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2012-04-18 17:42:09 +00:00
parent 39deb03855
commit 6d8649b9d3
2 changed files with 24 additions and 4 deletions
+16
View File
@@ -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)