Commit b55cda261bed13d84803aafbcf598734643e5235
1 parent
40552448
Exists in
master
and in
28 other branches
ActionItem21: to display the public path of the article
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@979 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
2 changed files
with
17 additions
and
0 deletions
Show diff stats
app/models/article.rb
test/unit/article_test.rb
@@ -104,4 +104,17 @@ class ArticleTest < Test::Unit::TestCase | @@ -104,4 +104,17 @@ class ArticleTest < Test::Unit::TestCase | ||
104 | assert a4.errors.invalid?(:slug) | 104 | assert a4.errors.invalid?(:slug) |
105 | end | 105 | end |
106 | 106 | ||
107 | + should 'calculate public path' do | ||
108 | + # top level | ||
109 | + a = profile.articles.build(:name => 'aaa') | ||
110 | + a.save! | ||
111 | + assert_equal "/#{profile.identifier}/aaa", a.public_path | ||
112 | + | ||
113 | + # child articles | ||
114 | + b = profile.articles.build(:name => 'bbb') | ||
115 | + b.parent = a | ||
116 | + b.save! | ||
117 | + assert_equal "/#{profile.identifier}/aaa/bbb", b.public_path | ||
118 | + end | ||
119 | + | ||
107 | end | 120 | end |