From 2f05036cdd3fc6d6335ede05a2efa5971fe19e47 Mon Sep 17 00:00:00 2001 From: Jon Atack Date: Mon, 5 Jan 2015 15:41:53 +0100 Subject: Clean up secure_token_test --- activerecord/test/cases/secure_token_test.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'activerecord') diff --git a/activerecord/test/cases/secure_token_test.rb b/activerecord/test/cases/secure_token_test.rb index 400fce8c6e..dc12b528dc 100644 --- a/activerecord/test/cases/secure_token_test.rb +++ b/activerecord/test/cases/secure_token_test.rb @@ -6,13 +6,13 @@ class SecureTokenTest < ActiveRecord::TestCase @user = User.new end - test "assing unique token values" do + def test_token_values_are_generated_for_specified_attributes_and_persisted_on_save @user.save assert_not_nil @user.token assert_not_nil @user.auth_token end - test "regenerate the secure key for the attribute" do + def test_regenerating_the_secure_token @user.save old_token = @user.token old_auth_token = @user.auth_token @@ -23,15 +23,15 @@ class SecureTokenTest < ActiveRecord::TestCase assert_not_equal @user.auth_token, old_auth_token end - test "raise and exception when with 10 attemps is reached" do + def test_raise_after_ten_unsuccessful_attempts_to_generate_a_unique_token User.stubs(:exists?).returns(*Array.new(10, true)) assert_raises(RuntimeError) do @user.save end end - test "assing unique token after 9 attemps reached" do - User.stubs(:exists?).returns(*Array.new(10){ |i| i == 9 ? false : true}) + def test_return_unique_token_after_nine_unsuccessful_attempts + User.stubs(:exists?).returns(*Array.new(10) { |i| i == 9 ? false : true }) @user.save assert_not_nil @user.token assert_not_nil @user.auth_token -- cgit v1.2.3