summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--test/functional/account_controller_test.rb6
-rw-r--r--test/test_helper.rb9
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