From ae3d542664147df35742c9255f3c6f968522baec Mon Sep 17 00:00:00 2001 From: Eric Davis Date: Thu, 19 Aug 2010 04:29:57 +0000 Subject: [PATCH] Merged r3905 from trunk. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.0-stable@3955 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- test/functional/account_controller_test.rb | 6 +----- test/test_helper.rb | 9 +++++++++ 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/test/functional/account_controller_test.rb b/test/functional/account_controller_test.rb index 61ad97430..2a8c9c66b 100644 --- a/test/functional/account_controller_test.rb +++ b/test/functional/account_controller_test.rb @@ -195,11 +195,7 @@ class AccountControllerTest < ActionController::TestCase should_assign_to :user should_redirect_to('my page') { {:controller => 'my', :action => 'account'} } - should "create a new user" do - user = User.last(:conditions => {:login => 'register'}) - assert user - assert_kind_of User, user - end + should_create_a_new_user { User.last(:conditions => {:login => 'register'}) } should 'set the user status to active' do user = User.last(:conditions => {:login => 'register'}) diff --git a/test/test_helper.rb b/test/test_helper.rb index c934e1bc2..15a1f1570 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -162,4 +162,13 @@ class ActiveSupport::TestCase end end end + + def self.should_create_a_new_user(&block) + should "create a new user" do + user = instance_eval &block + assert user + assert_kind_of User, user + assert !user.new_record? + end + end end -- 2.39.5