article_test.rb
1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
require File.dirname(__FILE__) + '/../test_helper'
class ArticleTest < Test::Unit::TestCase
fixtures :comatose_pages
def test_should_use_keywords_as_tags
article = Article.new
article.title = 'a test article'
article.body = 'lalala'
article.parent = Article.find_by_path('ze')
article.keywords = 'one, two, three'
article.save!
assert article.has_keyword?('one')
assert article.has_keyword?('two')
assert article.has_keyword?('three')
end
should 'have an associated profile' do
article = Article.new(:title => 'someuser', :body => "some text")
article.parent = Comatose::Page.root
article.save!
Profile.expects(:find_by_identifier).with("someuser")
article.profile
end
should 'get associated profile from name of root page' do
article = Article.new(:title => "test article", :body => 'some sample text')
article.parent = Article.find_by_path('ze')
article.save!
assert_equal 'ze/test-article', article.full_path
Profile.expects(:find_by_identifier).with("ze")
article.profile
end
end