2015-09-12 15:37:05 -05:00
|
|
|
require 'test_helper'
|
|
|
|
|
|
|
|
class PersonTest < ActiveSupport::TestCase
|
|
|
|
def test_sanity
|
|
|
|
assert Person
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_parents
|
|
|
|
parents = Person.just_parents
|
|
|
|
|
|
|
|
assert parents.count > 1, "Did not find more than one parent"
|
|
|
|
end
|
2015-10-23 19:34:59 -05:00
|
|
|
|
|
|
|
def test_name_first
|
|
|
|
assert_equal 1, Person.with_name('admin').count
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_name_last
|
|
|
|
smiths_count = Person.where(last_name: 'Smith').count
|
|
|
|
smiths = Person.with_name 'smith'
|
|
|
|
|
|
|
|
assert_equal smiths_count, smiths.count
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_name_full
|
|
|
|
assert_equal 1, Person.with_name('wanda worker').count
|
|
|
|
end
|
2015-09-12 15:37:05 -05:00
|
|
|
end
|