sqlite3, test coverage improvements, auto auth
This commit is contained in:
7
test/fixtures/people.yml
vendored
7
test/fixtures/people.yml
vendored
@ -42,3 +42,10 @@ sarah:
|
||||
email: sarah.smith@mailinator.com
|
||||
phone: 5005550006
|
||||
children: sally, nemo
|
||||
mmoser:
|
||||
first_name: Mark
|
||||
last_name: Moser
|
||||
email: markamoser@gmail.com
|
||||
phone: 3093634474
|
||||
admin: true
|
||||
activation_state: active
|
||||
|
15
test/models/child_test.rb
Normal file
15
test/models/child_test.rb
Normal file
@ -0,0 +1,15 @@
|
||||
require 'test_helper'
|
||||
|
||||
class ChildTest < ActiveSupport::TestCase
|
||||
def test_sanity
|
||||
assert Child
|
||||
end
|
||||
|
||||
def test_relations
|
||||
non_relatives = Child.not_related_to people(:marlin)
|
||||
smiths_count = non_relatives.where(last_name: 'smith').count
|
||||
|
||||
assert_equal 0, smiths_count
|
||||
assert_equal 1, non_relatives.count
|
||||
end
|
||||
end
|
@ -10,4 +10,19 @@ class PersonTest < ActiveSupport::TestCase
|
||||
|
||||
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
|
||||
|
Reference in New Issue
Block a user