Refactor: extract method to shoulda macro.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3905 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Eric Davis 2010-08-02 15:43:04 +00:00
parent d3158e37b9
commit 25037b841b
2 changed files with 10 additions and 5 deletions

View File

@ -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'})

View File

@ -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