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:
parent
d3158e37b9
commit
25037b841b
|
@ -195,11 +195,7 @@ class AccountControllerTest < ActionController::TestCase
|
||||||
should_assign_to :user
|
should_assign_to :user
|
||||||
should_redirect_to('my page') { {:controller => 'my', :action => 'account'} }
|
should_redirect_to('my page') { {:controller => 'my', :action => 'account'} }
|
||||||
|
|
||||||
should "create a new user" do
|
should_create_a_new_user { User.last(:conditions => {:login => 'register'}) }
|
||||||
user = User.last(:conditions => {:login => 'register'})
|
|
||||||
assert user
|
|
||||||
assert_kind_of User, user
|
|
||||||
end
|
|
||||||
|
|
||||||
should 'set the user status to active' do
|
should 'set the user status to active' do
|
||||||
user = User.last(:conditions => {:login => 'register'})
|
user = User.last(:conditions => {:login => 'register'})
|
||||||
|
|
|
@ -162,4 +162,13 @@ class ActiveSupport::TestCase
|
||||||
end
|
end
|
||||||
end
|
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
|
end
|
||||||
|
|
Loading…
Reference in New Issue