Yet more tests...
This commit is contained in:
parent
dfc85f089a
commit
15b550182c
9 changed files with 577 additions and 257 deletions
|
@ -5,7 +5,7 @@ class DiaryEntryTest < ActiveSupport::TestCase
|
|||
fixtures :diary_entries, :diary_comments, :languages
|
||||
|
||||
def test_diary_entry_count
|
||||
assert_equal 5, DiaryEntry.count
|
||||
assert_equal 6, DiaryEntry.count
|
||||
end
|
||||
|
||||
def test_diary_entry_validations
|
||||
|
@ -25,7 +25,7 @@ class DiaryEntryTest < ActiveSupport::TestCase
|
|||
end
|
||||
|
||||
def test_diary_entry_visible
|
||||
assert_equal 4, DiaryEntry.visible.count
|
||||
assert_equal 5, DiaryEntry.visible.count
|
||||
assert_raise ActiveRecord::RecordNotFound do
|
||||
DiaryEntry.visible.find(diary_entries(:deleted_entry).id)
|
||||
end
|
||||
|
|
|
@ -116,9 +116,9 @@ class UserTest < ActiveSupport::TestCase
|
|||
|
||||
def test_users_nearby
|
||||
# second user has their data public and is close by normal user
|
||||
assert_equal [users(:public_user)], users(:normal_user).nearby
|
||||
assert_equal [users(:public_user), users(:german_user)], users(:normal_user).nearby
|
||||
# second_user has normal user nearby, but normal user has their data private
|
||||
assert_equal [], users(:public_user).nearby
|
||||
assert_equal [users(:german_user)], users(:public_user).nearby
|
||||
# inactive_user has no user nearby
|
||||
assert_equal [], users(:inactive_user).nearby
|
||||
# north_pole_user has no user nearby, and doesn't throw exception
|
||||
|
@ -137,8 +137,8 @@ class UserTest < ActiveSupport::TestCase
|
|||
# friend.befriender = norm
|
||||
# friend.befriendee = sec
|
||||
# friend.save
|
||||
assert_equal [sec], norm.nearby
|
||||
assert_equal 1, norm.nearby.size
|
||||
assert_equal [sec], norm.friend_users
|
||||
assert_equal 1, norm.friend_users.size
|
||||
assert_equal 1, Friend.count
|
||||
assert norm.is_friends_with?(sec)
|
||||
assert !sec.is_friends_with?(norm)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue