public
Fork of halorgium/mephisto
Description: A mirror of the mephisto code-base
Homepage: http://mephistoblog.com/
Clone URL: git://github.com/technoweenie/mephisto.git
Click here to lend your support to: mephisto and make a donation at www.pledgie.com !
fixes to typo->mephisto converter in handling excerpts [danp]

git-svn-id: http://svn.techno-weenie.net/projects/mephisto/trunk@1238 
567b1171-46fb-0310-a4c9-b4bef9110e78
technoweenie (author)
Tue Jun 13 23:54:17 -0700 2006
commit  b1b351bd7b6de91f00d7bd0310d7acc7184afe43
tree    ddab426c878fe609d238a8a9ce84100e9f0da2b2
parent  1efd5959eeff4d3ed48574df39dc896e68666d28
...
45
46
47
 
 
 
 
48
49
50
51
52
53
 
 
54
55
56
...
45
46
47
48
49
50
51
52
53
54
55
 
 
56
57
58
59
60
0
@@ -45,12 +45,16 @@ module Typo
0
         ::User.find_by_login(Typo::User.find(typo_article.user_id).login)
0
 
0
       section_ids = find_or_create_sections(typo_article)
0
+
0
+ excerpt, body = !typo_article.extended.blank? ?
0
+ [typo_article.body, typo_article.extended] :
0
+ [nil, typo_article.body]
0
 
0
       ::Article.create! \
0
         :site => site,
0
         :title => typo_article.title,
0
- :excerpt => typo_article.excerpt,
0
- :body => typo_article.body,
0
+ :excerpt => excerpt,
0
+ :body => body,
0
         :created_at => typo_article.created_at,
0
         :published_at => typo_article.created_at,
0
         :updated_at => typo_article.updated_at,
...
6
7
8
9
10
 
 
11
12
13
...
16
17
18
19
20
 
 
21
22
23
24
25
 
 
 
 
 
 
 
 
 
 
 
26
27
28
...
6
7
8
 
 
9
10
11
12
13
...
16
17
18
 
 
19
20
21
22
23
24
 
25
26
27
28
29
30
31
32
33
34
35
36
37
38
0
@@ -6,8 +6,8 @@ module Typo
0
       OpenStruct.new(
0
         'user_id' => 1,
0
         'title' => 'article one',
0
- 'excerpt' => 'This is the short bit',
0
- 'body' => 'This is the long bit',
0
+ 'body' => 'This is the short bit',
0
+ 'extended' => 'This is the long bit',
0
         'created_at' => Time.now,
0
         'updated_at' => Time.now,
0
         'published_at' => Time.now,
0
@@ -16,13 +16,23 @@ module Typo
0
       OpenStruct.new(
0
         'user_id' => 2,
0
         'title' => 'article two',
0
- 'excerpt' => 'This is the short bit 2',
0
- 'body' => 'This is the long bit 2',
0
+ 'body' => 'This is the short bit 2',
0
+ 'extended' => 'This is the long bit 2',
0
         'created_at' => Time.now,
0
         'updated_at' => Time.now,
0
         'published_at' => Time.now,
0
         'categories' => [OpenStruct.new(:name => 'foo')]
0
- )
0
+ ),
0
+ OpenStruct.new(
0
+ 'user_id' => 2,
0
+ 'title' => 'article three',
0
+ 'body' => 'This is an article without a short bit',
0
+ 'extended' => '',
0
+ 'created_at' => Time.now,
0
+ 'updated_at' => Time.now,
0
+ 'published_at' => Time.now,
0
+ 'categories' => [OpenStruct.new(:name => 'foo')]
0
+ )
0
     ]
0
     
0
     def self.find(arg)
...
37
38
39
 
 
40
41
42
43
44
 
 
 
 
 
 
 
 
 
 
45
46
47
...
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
0
@@ -37,11 +37,23 @@ class TypoImporterTest < Test::Unit::TestCase
0
     typo_article = Typo::Article.find(1)
0
     assert_difference Article, :count do
0
       article = Typo.create_article(sites(:first), typo_article)
0
+ assert_equal typo_article.body, article.excerpt
0
+ assert_equal typo_article.extended, article.body
0
       assert_equal sites(:first), article.site
0
       assert_equal User.find_by_login(Typo::User.find(typo_article.user_id).login), article.updater
0
     end
0
   end
0
   
0
+ def test_should_set_typo_body_to_mephisto_body_if_no_extended
0
+ Typo.import_users
0
+ typo_article = Typo::Article.find(3)
0
+ assert_difference Article, :count do
0
+ article = Typo.create_article(sites(:first), typo_article)
0
+ assert_equal typo_article.body, article.body
0
+ assert_nil article.excerpt
0
+ end
0
+ end
0
+
0
   def test_should_create_comment
0
     typo_comment = OpenStruct.new(
0
       "body" => 'This is a comment',

Comments

    No one has commented yet.