Commit 8e6100cdf6f92de41fcf225a8494730a464f273f
1 parent
3fb6b301
Exists in
master
and in
27 other branches
display_filter: adding more tests
Showing
3 changed files
with
25 additions
and
0 deletions
Show diff stats
app/models/person.rb
test/unit/article_test.rb
| ... | ... | @@ -2018,4 +2018,23 @@ class ArticleTest < ActiveSupport::TestCase |
| 2018 | 2018 | assert_equal [a], Article.display_filter(user, p) |
| 2019 | 2019 | end |
| 2020 | 2020 | |
| 2021 | + should 'display_filter do not show person private content to non friends passing nil as profile parameter' do | |
| 2022 | + user = create_user('someuser').person | |
| 2023 | + p = fast_create(Person) | |
| 2024 | + assert !p.is_a_friend?(user) | |
| 2025 | + assert !user.is_admin? | |
| 2026 | + Article.delete_all | |
| 2027 | + fast_create(Article, :published => false, :profile_id => p.id) | |
| 2028 | + assert_equal [], Article.display_filter(user, nil) | |
| 2029 | + end | |
| 2030 | + | |
| 2031 | + should 'display_filter do not show community private content to non members passing nil as profile parameter' do | |
| 2032 | + user = create_user('someuser').person | |
| 2033 | + p = fast_create(Community) | |
| 2034 | + assert !user.is_member_of?(p) | |
| 2035 | + Article.delete_all | |
| 2036 | + fast_create(Article, :published => false, :profile_id => p.id) | |
| 2037 | + assert_equal [], Article.display_filter(user, nil) | |
| 2038 | + end | |
| 2039 | + | |
| 2021 | 2040 | end | ... | ... |
test/unit/person_test.rb
| ... | ... | @@ -1631,4 +1631,9 @@ class PersonTest < ActiveSupport::TestCase |
| 1631 | 1631 | assert person.can_change_homepage? |
| 1632 | 1632 | end |
| 1633 | 1633 | |
| 1634 | + should 'follow? return false when no profile is passed as parameter' do | |
| 1635 | + person = Person.new | |
| 1636 | + assert_equal false, person.follows?(nil) | |
| 1637 | + end | |
| 1638 | + | |
| 1634 | 1639 | end | ... | ... |