# Unit Testing with authlogic

**URL:** <https://www.ruby-forum.com/t/unit-testing-with-authlogic/169480>\
**Category:** Rails\
**Created:** [June 4, 2009, 9:12am UTC](https://www.ruby-forum.com/t/unit-testing-with-authlogic/169480 "2009-06-04T09:12:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![elioncho](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/ed8c4c/32.png) [@elioncho](https://www.ruby-forum.com/u/elioncho)\
**Post date:** [June 4, 2009, 9:12am UTC](https://www.ruby-forum.com/t/unit-testing-with-authlogic/169480/1 "2009-06-04T09:12:31Z")

</div>

Hi guys,

I am new to the testing world and was trying to test my user model. My  
user model has the acts\_as\_authentic line on it, so a number of things  
are added to it.

I added the:

require “authlogic/test\_case”

to the test\_helper.rb and did this on my user\_test.rb. Its just a  
simple test to see if check if authlogic is checking that certains e-  
mails could be invalid. But my test fails. Can anyone point me up in  
the right direction on how to make this test?

require ‘test\_helper’  
class UserTest \< ActiveSupport::TestCase  
setup :activate\_authlogic

test “invalid email” do  
user = User.new(:email =\> ‘something’)  
assert user.errors.invalid?(:email)  
end

end
