trabajo-afectivo/test/unit/user_test.rb

127 lines
3.4 KiB
Ruby
Raw Normal View History

# encoding: utf-8
require 'test_helper'
class UserTest < ActiveSupport::TestCase
test 'user' do
tests = [
{
:create => {
:firstname => 'Firstname',
:lastname => 'Lastname',
:email => 'some@example.com',
:login => 'some@example.com',
:created_by_id => 1,
},
:create_verify => {
:firstname => 'Firstname',
:lastname => 'Lastname',
:email => 'some@example.com',
:login => 'some@example.com',
},
},
{
:create => {
:firstname => 'Firstname Lastname',
:lastname => '',
:email => 'some@example.com',
:login => 'some@example.com',
:created_by_id => 1,
},
:create_verify => {
:firstname => 'Firstname',
:lastname => 'Lastname',
:email => 'some@example.com',
:login => 'some@example.com',
},
},
2012-11-02 07:14:59 +00:00
{
:create => {
:firstname => 'Firstname Lastname',
:lastname => nil,
:email => 'some@example.com',
:login => 'some@example.com',
:created_by_id => 1,
},
:create_verify => {
:firstname => 'Firstname',
:lastname => 'Lastname',
:email => 'some@example.com',
:login => 'some@example.com',
},
},
{
:create => {
:firstname => 'Lastname, Firstname',
:lastname => '',
:email => 'some@example.com',
:login => 'some@example.com',
:created_by_id => 1,
},
:create_verify => {
:firstname => 'Firstname',
:lastname => 'Lastname',
:email => 'some@example.com',
:login => 'some@example.com',
},
},
{
:create => {
:firstname => '',
:lastname => '',
:email => 'firstname.lastname@example.com',
:login => 'login',
:created_by_id => 1,
},
:create_verify => {
:firstname => 'Firstname',
:lastname => 'Lastname',
:email => 'firstname.lastname@example.com',
:login => 'login',
},
},
{
:create => {
:firstname => '',
:lastname => '',
:email => 'FIRSTNAME.lastname@example.com',
:login => 'login',
:created_by_id => 1,
},
:create_verify => {
:firstname => 'Firstname',
:lastname => 'Lastname',
:email => 'firstname.lastname@example.com',
:login => 'login',
},
},
2012-11-02 07:14:59 +00:00
{
:create => {
:firstname => nil,
:lastname => nil,
:email => 'FIRSTNAME.lastname@example.com',
:login => 'login',
:created_by_id => 1,
},
:create_verify => {
:firstname => 'Firstname',
:lastname => 'Lastname',
:email => 'firstname.lastname@example.com',
:login => 'login',
},
},
]
tests.each { |test|
user = User.create( test[:create] )
test[:create_verify].each { |key, value|
assert_equal( user[key], value )
}
user.destroy
}
end
end