GitHub Sale: sign up for any paid plan this week and pay nothing until January 1, 2009!  [ hide ]

public
Fork of halorgium/mephisto
Description: A mirror of the mephisto code-base
Homepage: http://mephistoblog.com/
Clone URL: git://github.com/zmack/mephisto.git
fix bug where ArticleDrop#url was passing absolute urls to the 
#absolute_url helper
technoweenie (author)
Sun Mar 30 23:16:27 -0700 2008
commit  e668bea7af08a86c26f0b856b8f52555a37f2154
tree    1c56460891451ec6621ad793059a6dbcb9b1003d
parent  281dd17cb2b7a970260b27bbdc5e7d24e7220633
...
43
44
45
46
 
47
48
49
...
43
44
45
 
46
47
48
49
0
@@ -43,7 +43,7 @@ class ArticleDrop < BaseDrop
0
   end
0
 
0
   def url
0
- @url ||= absolute_url(@site.permalink_for(@source))
0
+ @url ||= absolute_url(@site.permalink_for(@source)[1..-1])
0
   end
0
 
0
   def comments_feed_url
...
112
113
114
115
116
 
 
117
118
119
...
112
113
114
 
 
115
116
117
118
119
0
@@ -112,8 +112,8 @@ module Mephisto
0
       old_published = article.published_at
0
       article.published_at ||= Time.now.utc
0
       article.article_id ||= article.id
0
- permalink_style.split('/').inject [''] do |s, piece|
0
- s << ((name = variable_format?(piece)) && PERMALINK_OPTIONS.keys.include?(name.to_sym) ? variable_value_for(article, name) : piece)
0
+ '/' + permalink_style.split('/').collect! do |piece|
0
+ (name = variable_format?(piece)) && PERMALINK_OPTIONS.keys.include?(name.to_sym) ? variable_value_for(article, name) : piece
0
       end.join('/')
0
     ensure
0
       article.published_at = old_published
...
1
2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
4
5
...
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
...
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
...
99
100
101
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
102
103
104
0
@@ -1,5 +1,33 @@
0
 require File.dirname(__FILE__) + '/../test_helper'
0
 
0
+['', '/blog'].each do |root|
0
+ context "Article Drop with relative root = #{root.inspect}" do
0
+ fixtures :sites, :sections, :contents, :assigned_sections, :users, :tags, :taggings, :assigned_assets, :assets
0
+
0
+ setup do
0
+ @context = mock_context('site' => sites(:first).to_liquid)
0
+ @article = contents(:welcome).to_liquid(:mode => :single)
0
+ @article.context = @context
0
+ Mephisto::Liquid::UrlMethods.stubs(:relative_url_root).returns(root)
0
+ end
0
+
0
+ specify "should show article url" do
0
+ t = Time.now.utc - 3.days
0
+ assert_equal "#{root}/#{t.year}/#{t.month}/#{t.day}/welcome-to-mephisto", @article.url
0
+ end
0
+
0
+ specify "should show comments feed url" do
0
+ t = Time.now.utc - 3.days
0
+ assert_equal "#{root}/#{t.year}/#{t.month}/#{t.day}/welcome-to-mephisto/comments.xml", @article.comments_feed_url
0
+ end
0
+
0
+ specify "should change feed url" do
0
+ t = Time.now.utc - 3.days
0
+ assert_equal "#{root}/#{t.year}/#{t.month}/#{t.day}/welcome-to-mephisto/changes.xml", @article.changes_feed_url
0
+ end
0
+ end
0
+end
0
+
0
 context "Article Drop" do
0
   fixtures :sites, :sections, :contents, :assigned_sections, :users, :tags, :taggings, :assigned_assets, :assets
0
   
0
@@ -71,21 +99,6 @@ context "Article Drop" do
0
     assert_equal '<p>body</p>', a.send(:body_for_mode, :list)
0
   end
0
 
0
- specify "should show article url" do
0
- t = Time.now.utc - 3.days
0
- assert_equal "/#{t.year}/#{t.month}/#{t.day}/welcome-to-mephisto", @article.url
0
- end
0
-
0
- specify "should show comments feed url" do
0
- t = Time.now.utc - 3.days
0
- assert_equal "/#{t.year}/#{t.month}/#{t.day}/welcome-to-mephisto/comments.xml", @article.comments_feed_url
0
- end
0
-
0
- specify "should change feed url" do
0
- t = Time.now.utc - 3.days
0
- assert_equal "/#{t.year}/#{t.month}/#{t.day}/welcome-to-mephisto/changes.xml", @article.changes_feed_url
0
- end
0
-
0
   specify "should show taggable tags" do
0
     assert_equal %w(rails), contents(:another).to_liquid.tags
0
   end
...
1
2
3
4
 
5
6
7
...
1
2
3
 
4
5
6
7
0
@@ -1,7 +1,7 @@
0
 require File.dirname(__FILE__) + '/../test_helper'
0
 
0
 class SectionDropTest < Test::Unit::TestCase
0
- fixtures :sites, :sections, :contents
0
+ fixtures :sites, :sections, :contents, :assigned_sections
0
 
0
   def test_equality
0
     section = sections(:home).to_liquid

Comments

    No one has commented yet.