summaryrefslogtreecommitdiffstats
path: root/test/unit/user_test.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2012-04-22 11:56:47 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2012-04-22 11:56:47 +0000
commitb960470d7817843906d42628d8bb4228ee49b2d9 (patch)
tree9c16e3fe4ae68e36e4d3c6c0dfebb267eab9a774 /test/unit/user_test.rb
parent4a3f038595922dc5fef9f3541363a16078a5ace9 (diff)
downloadredmine-b960470d7817843906d42628d8bb4228ee49b2d9.tar.gz
redmine-b960470d7817843906d42628d8bb4228ee49b2d9.zip
Removed object_daddy dependency.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9469 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/user_test.rb')
-rw-r--r--test/unit/user_test.rb22
1 files changed, 13 insertions, 9 deletions
diff --git a/test/unit/user_test.rb b/test/unit/user_test.rb
index cf21298f0..cbd3de5e9 100644
--- a/test/unit/user_test.rb
+++ b/test/unit/user_test.rb
@@ -337,8 +337,10 @@ class UserTest < ActiveSupport::TestCase
def test_destroy_should_nullify_changesets
changeset = Changeset.create!(
- :repository => Repository::Subversion.generate!(
- :project_id => 1
+ :repository => Repository::Subversion.create!(
+ :project_id => 1,
+ :url => 'file:///tmp',
+ :identifier => 'tmp'
),
:revision => '12',
:committed_on => Time.now,
@@ -378,9 +380,9 @@ class UserTest < ActiveSupport::TestCase
end
should "select the exact matching user first" do
- case_sensitive_user = User.generate_with_protected!(
- :login => 'changed', :password => 'admin',
- :password_confirmation => 'admin')
+ case_sensitive_user = User.generate! do |user|
+ user.password = "admin"
+ end
# bypass validations to make it appear like existing data
case_sensitive_user.update_attribute(:login, 'ADMIN')
@@ -628,7 +630,7 @@ class UserTest < ActiveSupport::TestCase
should "return the existing api token value" do
user = User.generate_with_protected!
- token = Token.generate!(:action => 'api')
+ token = Token.create!(:action => 'api')
user.api_token = token
assert user.save
@@ -643,7 +645,7 @@ class UserTest < ActiveSupport::TestCase
should "return nil if the key is found for an inactive user" do
user = User.generate_with_protected!(:status => User::STATUS_LOCKED)
- token = Token.generate!(:action => 'api')
+ token = Token.create!(:action => 'api')
user.api_token = token
user.save
@@ -652,7 +654,7 @@ class UserTest < ActiveSupport::TestCase
should "return the user if the key is found for an active user" do
user = User.generate_with_protected!(:status => User::STATUS_ACTIVE)
- token = Token.generate!(:action => 'api')
+ token = Token.create!(:action => 'api')
user.api_token = token
user.save
@@ -823,7 +825,9 @@ class UserTest < ActiveSupport::TestCase
end
def test_own_account_deletable_should_be_true_for_an_admin_if_other_admin_exists
- User.generate_with_protected(:admin => true)
+ User.generate! do |user|
+ user.admin = true
+ end
with_settings :unsubscribe => '1' do
assert_equal true, User.find(1).own_account_deletable?