29 lines
576 B
Ruby
29 lines
576 B
Ruby
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
|
|
|
|
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
|
|
end
|