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 !
dont save CachedPage when caching is not allowed

git-svn-id: http://svn.techno-weenie.net/projects/mephisto/trunk@1383 
567b1171-46fb-0310-a4c9-b4bef9110e78
technoweenie (author)
Mon Jul 17 13:04:16 -0700 2006
commit  5e26f56006c09f3310969f244b8b876cff39dd58
tree    83d0a412e9c2c017a709cbe2975d215e12c5d5e3
parent  0eb2bba245d09cc5d45ae0f61333003bb8e42c4d
...
34
35
36
37
 
 
38
39
40
...
129
130
131
132
133
 
 
 
 
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
153
154
155
156
...
34
35
36
 
37
38
39
40
41
...
130
131
132
 
 
133
134
135
136
137
138
139
140
141
 
 
 
 
 
 
 
 
 
 
 
 
 
 
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
0
@@ -34,7 +34,8 @@ class CachingTest < ActionController::IntegrationTest
0
     assert_difference Article, :count do
0
       assert_expires_pages section_url_for(:home),
0
                            feed_url_for(:home) do
0
- writer.create :title => 'This is a new article & title', :body => 'this is a new article body', :sections => [sections(:home)], :published_at => Time.now
0
+ writer.create :title => 'This is a new article & title', :body => 'this is a new article body', :sections => [sections(:home)], :published_at => 5.minutes.ago
0
+ RAILS_DEFAULT_LOGGER.warn "HOLY FUCKING SHIT"
0
       end
0
     end
0
     
0
@@ -129,27 +130,31 @@ class CachingTest < ActionController::IntegrationTest
0
   def test_should_not_cache_bad_urls
0
     visitor = visit
0
     pages = ['/about/blah', '/foo/bar', '2006/1/2/fasd']
0
- assert_expires_pages *pages do
0
- pages.each { |p| visitor.get p }
0
+ assert_no_difference CachedPage, :count do
0
+ assert_expires_pages *pages do
0
+ pages.each { |p| visitor.get p }
0
+ end
0
     end
0
   end
0
 
0
   protected
0
     def visit_sections_and_feeds_with(visitor)
0
- assert_caches_page section_url_for(:home) do
0
- visitor.read sections(:home)
0
- end
0
-
0
- assert_caches_page section_url_for(:about) do
0
- visitor.read sections(:about)
0
- end
0
-
0
- assert_caches_page feed_url_for(:home) do
0
- visitor.syndicate sections(:home)
0
- end
0
-
0
- assert_caches_page feed_url_for(:about) do
0
- visitor.syndicate sections(:about)
0
+ assert_difference CachedPage, :count, 4 do
0
+ assert_caches_page section_url_for(:home) do
0
+ visitor.read sections(:home)
0
+ end
0
+
0
+ assert_caches_page section_url_for(:about) do
0
+ visitor.read sections(:about)
0
+ end
0
+
0
+ assert_caches_page feed_url_for(:home) do
0
+ visitor.syndicate sections(:home)
0
+ end
0
+
0
+ assert_caches_page feed_url_for(:about) do
0
+ visitor.syndicate sections(:about)
0
+ end
0
       end
0
     end
0
 end
0
\ No newline at end of file
...
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
35
36
37
...
17
18
19
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
0
@@ -17,20 +17,21 @@ module Caboose # :nodoc:
0
       end
0
 
0
       protected
0
- # An array of the current page's references.
0
- #
0
- # self.cached_references << @post
0
- # self.cached_references += @post.comments
0
- #
0
- def cached_references
0
- @cached_references ||= []
0
- end
0
-
0
- # Saves a CachedPage for the current request with the current references. This is called in an after filter if #caches_page_with_references
0
- # is used.
0
- def cache_page_with_references
0
- CachedPage.create_by_url(url_for(:only_path => true, :skip_relative_url_root => true), cached_references)
0
- end
0
+ # An array of the current page's references.
0
+ #
0
+ # self.cached_references << @post
0
+ # self.cached_references += @post.comments
0
+ #
0
+ def cached_references
0
+ @cached_references ||= []
0
+ end
0
+
0
+ # Saves a CachedPage for the current request with the current references. This is called in an after filter if #caches_page_with_references
0
+ # is used.
0
+ def cache_page_with_references
0
+ return unless perform_caching && caching_allowed
0
+ CachedPage.create_by_url(url_for(:only_path => true, :skip_relative_url_root => true), cached_references)
0
+ end
0
     end
0
   end
0
 end
0
\ No newline at end of file

Comments

    No one has commented yet.