Commit 5167646409d9f13eafacc8494aa7ea79149bf564
1 parent
13239c9a
Exists in
ratings_minor_fixes
and in
4 other branches
avoid exception in recent content block used in environment without portal community defined
Showing
2 changed files
with
12 additions
and
1 deletions
Show diff stats
plugins/recent_content/lib/recent_content_block.rb
plugins/recent_content/test/unit/recent_content_block_test.rb
... | ... | @@ -156,4 +156,15 @@ class RecentContentBlockViewTest < ActionView::TestCase |
156 | 156 | assert_equal [article.id], block.api_content['articles'].map {|a| a[:id]} |
157 | 157 | end |
158 | 158 | |
159 | + should 'parents return an empty array for environment without portal community' do | |
160 | + environment = fast_create(Environment) | |
161 | + block = RecentContentBlock.new | |
162 | + box = mock() | |
163 | + block.stubs(:box).returns(box) | |
164 | + box.stubs(:owner).returns(environment) | |
165 | + | |
166 | + assert_nil environment.portal_community | |
167 | + assert_equal [], block.parents | |
168 | + end | |
169 | + | |
159 | 170 | end | ... | ... |