<?xml version="1.0" encoding="UTF-8"?>
<ticket>
  <assigned-user-id type="integer">17223</assigned-user-id>
  <attachments-count type="integer">2</attachments-count>
  <closed type="boolean">true</closed>
  <created-at type="datetime">2008-09-06T10:50:54-04:00</created-at>
  <creator-id type="integer">1016</creator-id>
  <milestone-due-on type="datetime" nil="true"></milestone-due-on>
  <milestone-id type="integer" nil="true"></milestone-id>
  <number type="integer">68</number>
  <permalink>testing-fragmentaction-cache-to-be-generated-or-expired</permalink>
  <priority type="integer">24509</priority>
  <project-id type="integer">5807</project-id>
  <raw-data type="binary" nil="true" encoding="base64"></raw-data>
  <state>refused</state>
  <tag>enhancement</tag>
  <title>Testing fragment/action cache to be generated or expired</title>
  <updated-at type="datetime">2009-06-09T19:51:20-04:00</updated-at>
  <user-id type="integer">17223</user-id>
  <user-name>Joe Ferris</user-name>
  <creator-name>Fernando Blat</creator-name>
  <assigned-user-name>Joe Ferris</assigned-user-name>
  <url>http://thoughtbot.lighthouseapp.com/projects/5807/tickets/68</url>
  <original-body>Hi,

I have beeing adding some methods for testing that action cache is generated or expired, and the same with fragment cache in functional tests.

I attach a patch with the methods added to lib/shoulda/controller/helpers.rb, but I don't know if you consider that the best place. I did this because I needed instance methods.

I added also a new cache storage engine at lib/shoulda/test_store.rb

Also you can find some tests in posts_controller_test.rb and the new tags_controller_test.rb

Take a look if you find this useful :)

I have a GitHub branch for it, too: http://github.com/ferblape/shoulda/tree/master

Cheers</original-body>
  <latest-body>Hi,

I have beeing adding some methods for testing that action cache is generated or expired, and the same with fragment cache in functional tests.

I attach a patch with the methods added to lib/shoulda/controller/helpers.rb, but I don't know if you consider that the best place. I did this because I needed instance methods.

I added also a new cache storage engine at lib/shoulda/test_store.rb

Also you can find some tests in posts_controller_test.rb and the new tags_controller_test.rb

Take a look if you find this useful :)

I have a GitHub branch for it, too: http://github.com/ferblape/shoulda/tree/master

Cheers</latest-body>
  <original-body-html>&lt;div&gt;&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I have beeing adding some methods for testing that action cache
is generated or expired, and the same with fragment cache in
functional tests.&lt;/p&gt;
&lt;p&gt;I attach a patch with the methods added to
lib/shoulda/controller/helpers.rb, but I don't know if you consider
that the best place. I did this because I needed instance
methods.&lt;/p&gt;
&lt;p&gt;I added also a new cache storage engine at
lib/shoulda/test_store.rb&lt;/p&gt;
&lt;p&gt;Also you can find some tests in posts_controller_test.rb and the
new tags_controller_test.rb&lt;/p&gt;
&lt;p&gt;Take a look if you find this useful :)&lt;/p&gt;
&lt;p&gt;I have a GitHub branch for it, too: &lt;a href=&quot;http://github.com/ferblape/shoulda/tree/master&quot;&gt;http://github.com/ferblape/shoul...&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Cheers&lt;/p&gt;&lt;/div&gt;</original-body-html>
  <versions type="array">
    <version type="Ticket::Version">
      <assigned-user-id type="integer">13443</assigned-user-id>
      <attachments-count type="integer">0</attachments-count>
      <body>Hi,

I have beeing adding some methods for testing that action cache is generated or expired, and the same with fragment cache in functional tests.

I attach a patch with the methods added to lib/shoulda/controller/helpers.rb, but I don't know if you consider that the best place. I did this because I needed instance methods.

I added also a new cache storage engine at lib/shoulda/test_store.rb

Also you can find some tests in posts_controller_test.rb and the new tags_controller_test.rb

Take a look if you find this useful :)

I have a GitHub branch for it, too: http://github.com/ferblape/shoulda/tree/master

Cheers</body>
      <body-html>&lt;div&gt;&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I have beeing adding some methods for testing that action cache
is generated or expired, and the same with fragment cache in
functional tests.&lt;/p&gt;
&lt;p&gt;I attach a patch with the methods added to
lib/shoulda/controller/helpers.rb, but I don't know if you consider
that the best place. I did this because I needed instance
methods.&lt;/p&gt;
&lt;p&gt;I added also a new cache storage engine at
lib/shoulda/test_store.rb&lt;/p&gt;
&lt;p&gt;Also you can find some tests in posts_controller_test.rb and the
new tags_controller_test.rb&lt;/p&gt;
&lt;p&gt;Take a look if you find this useful :)&lt;/p&gt;
&lt;p&gt;I have a GitHub branch for it, too: &lt;a href=&quot;http://github.com/ferblape/shoulda/tree/master&quot;&gt;http://github.com/ferblape/shoul...&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Cheers&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2008-09-06T10:50:54-04:00</created-at>
      <creator-id type="integer">1016</creator-id>
      <diffable-attributes type="yaml">--- {}

</diffable-attributes>
      <milestone-id type="integer" nil="true"></milestone-id>
      <number type="integer">68</number>
      <permalink>testing-fragmentaction-cache-to-be-generated-or-expired</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">5807</project-id>
      <state>new</state>
      <tag>enhancement</tag>
      <title>Testing fragment/action cache to be generated or expired</title>
      <updated-at type="datetime">2008-09-06T10:50:59-04:00</updated-at>
      <user-id type="integer">1016</user-id>
      <user-name>Fernando Blat</user-name>
      <creator-name>Fernando Blat</creator-name>
      <assigned-user-name>Tammer Saleh</assigned-user-name>
      <url>http://thoughtbot.lighthouseapp.com/projects/5807/tickets/68</url>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer" nil="true"></assigned-user-id>
      <attachments-count type="integer">1</attachments-count>
      <body>Hi Fernando,

This looks like a really useful addition to shoulda, but I have a couple of questions about the patch.

Can we do without the call to ActionController::Base.cache_store.clear that's in each setup block?   Not only do the setup blocks get called all the time, but we're aiming soon to convert Shoulda to a gem so that it's useable outside of rails projects.

Running rake produces the following warnings:
&lt;pre&gt;
  * WARNING: 'test: Logged in viewing posts for a user should respond with success. ' is already defined
  * WARNING: 'test: Logged in viewing posts for a user should assign @user. ' is already defined
  * WARNING: 'test: Logged in viewing posts for a user should assign @posts. ' is already defined
  * WARNING: 'test: Logged in viewing posts for a user should not assign to @foo. ' is already defined
  * WARNING: 'test: Logged in viewing posts for a user should not assign to @bar. ' is already defined
&lt;/pre&gt;

And finally, is it possible to do away with the &quot;map.connect ':controller/:action/:id'&quot; route in the test suite?  I worry that this catch-all route could hide future failures in the tests.

Thanks for the help,
Tammer</body>
      <body-html>&lt;div&gt;&lt;p&gt;Hi Fernando,&lt;/p&gt;
&lt;p&gt;This looks like a really useful addition to shoulda, but I have
a couple of questions about the patch.&lt;/p&gt;
&lt;p&gt;Can we do without the call to
ActionController::Base.cache_store.clear that's in each setup
block? Not only do the setup blocks get called all the time, but
we're aiming soon to convert Shoulda to a gem so that it's useable
outside of rails projects.&lt;/p&gt;
&lt;p&gt;Running rake produces the following warnings:&lt;/p&gt;
&lt;pre&gt;
  * WARNING: 'test: Logged in viewing posts for a user should respond with success. ' is already defined
  * WARNING: 'test: Logged in viewing posts for a user should assign @user. ' is already defined
  * WARNING: 'test: Logged in viewing posts for a user should assign @posts. ' is already defined
  * WARNING: 'test: Logged in viewing posts for a user should not assign to @foo. ' is already defined
  * WARNING: 'test: Logged in viewing posts for a user should not assign to @bar. ' is already defined
&lt;/pre&gt;
&lt;p&gt;And finally, is it possible to do away with the &quot;map.connect
':controller/:action/:id'&quot; route in the test suite? I worry that
this catch-all route could hide future failures in the tests.&lt;/p&gt;
&lt;p&gt;Thanks for the help, Tammer&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2008-09-10T09:29:56-04:00</created-at>
      <creator-id type="integer">1016</creator-id>
      <diffable-attributes type="yaml">--- 
:assigned_user: 13443
</diffable-attributes>
      <milestone-id type="integer" nil="true"></milestone-id>
      <number type="integer">68</number>
      <permalink>testing-fragmentaction-cache-to-be-generated-or-expired</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">5807</project-id>
      <state>new</state>
      <tag>enhancement</tag>
      <title>Testing fragment/action cache to be generated or expired</title>
      <updated-at type="datetime">2008-09-10T09:30:02-04:00</updated-at>
      <user-id type="integer">13443</user-id>
      <user-name>Tammer Saleh</user-name>
      <creator-name>Fernando Blat</creator-name>
      <assigned-user-name nil="true"></assigned-user-name>
      <url>http://thoughtbot.lighthouseapp.com/projects/5807/tickets/68</url>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer" nil="true"></assigned-user-id>
      <attachments-count type="integer">1</attachments-count>
      <body>Hi!

I'm attaching a new patch that:

- only clears cache if is defined ActionController and if perform_caching is true

- corrects all the warnings

- avoids the default route and creates a new resource :tags

Thanks for the interest!</body>
      <body-html>&lt;div&gt;&lt;p&gt;Hi!&lt;/p&gt;
&lt;p&gt;I'm attaching a new patch that:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;only clears cache if is defined ActionController and if
perform_caching is true&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;corrects all the warnings&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;avoids the default route and creates a new resource :tags&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Thanks for the interest!&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2008-09-10T11:44:00-04:00</created-at>
      <creator-id type="integer">1016</creator-id>
      <diffable-attributes type="yaml">--- {}

</diffable-attributes>
      <milestone-id type="integer" nil="true"></milestone-id>
      <number type="integer">68</number>
      <permalink>testing-fragmentaction-cache-to-be-generated-or-expired</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">5807</project-id>
      <state>new</state>
      <tag>enhancement</tag>
      <title>Testing fragment/action cache to be generated or expired</title>
      <updated-at type="datetime">2008-09-10T11:44:02-04:00</updated-at>
      <user-id type="integer">1016</user-id>
      <user-name>Fernando Blat</user-name>
      <creator-name>Fernando Blat</creator-name>
      <assigned-user-name nil="true"></assigned-user-name>
      <url>http://thoughtbot.lighthouseapp.com/projects/5807/tickets/68</url>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer" nil="true"></assigned-user-id>
      <attachments-count type="integer">2</attachments-count>
      <body>This is a good direction, but I really still don't like that kind of  
platform specific code being in the setup method at all.  It would  
make more sense to me to submit a patch to rails that clears the cache  
via ActiveSupport::TestCase.</body>
      <body-html>&lt;div&gt;&lt;p&gt;This is a good direction, but I really still don't like that
kind of platform specific code being in the setup method at all. It
would make more sense to me to submit a patch to rails that clears
the cache via ActiveSupport::TestCase.&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2008-09-10T12:40:07-04:00</created-at>
      <creator-id type="integer">1016</creator-id>
      <diffable-attributes type="yaml">--- {}

</diffable-attributes>
      <milestone-id type="integer" nil="true"></milestone-id>
      <number type="integer">68</number>
      <permalink>testing-fragmentaction-cache-to-be-generated-or-expired</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">5807</project-id>
      <state>new</state>
      <tag>enhancement</tag>
      <title>Testing fragment/action cache to be generated or expired</title>
      <updated-at type="datetime">2008-09-10T12:40:12-04:00</updated-at>
      <user-id type="integer">13443</user-id>
      <user-name>Tammer Saleh</user-name>
      <creator-name>Fernando Blat</creator-name>
      <assigned-user-name nil="true"></assigned-user-name>
      <url>http://thoughtbot.lighthouseapp.com/projects/5807/tickets/68</url>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer" nil="true"></assigned-user-id>
      <attachments-count type="integer">2</attachments-count>
      <body>Ok,

I'll check it out and try to have a second thought when I come back from my holidays in 15 days. 

Meanwhile, if you want, you can discard the ticket.</body>
      <body-html>&lt;div&gt;&lt;p&gt;Ok,&lt;/p&gt;
&lt;p&gt;I'll check it out and try to have a second thought when I come
back from my holidays in 15 days.&lt;/p&gt;
&lt;p&gt;Meanwhile, if you want, you can discard the ticket.&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2008-09-10T14:52:25-04:00</created-at>
      <creator-id type="integer">1016</creator-id>
      <diffable-attributes type="yaml">--- {}

</diffable-attributes>
      <milestone-id type="integer" nil="true"></milestone-id>
      <number type="integer">68</number>
      <permalink>testing-fragmentaction-cache-to-be-generated-or-expired</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">5807</project-id>
      <state>new</state>
      <tag>enhancement</tag>
      <title>Testing fragment/action cache to be generated or expired</title>
      <updated-at type="datetime">2008-09-10T14:52:31-04:00</updated-at>
      <user-id type="integer">1016</user-id>
      <user-name>Fernando Blat</user-name>
      <creator-name>Fernando Blat</creator-name>
      <assigned-user-name nil="true"></assigned-user-name>
      <url>http://thoughtbot.lighthouseapp.com/projects/5807/tickets/68</url>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer" nil="true"></assigned-user-id>
      <attachments-count type="integer">2</attachments-count>
      <body>And what about [hacking the run method](http://www.inwebwetrust.net/post/2008/08/19/redefine-the-run-method-of-test-unit-testcase)?

The problem of add the clear method to Rails is that not all cache storages support that method (for example disk store), so, it's quite probable that they don't like that approach.</body>
      <body-html>&lt;div&gt;&lt;p&gt;And what about &lt;a href=&quot;http://www.inwebwetrust.net/post/2008/08/19/redefine-the-run-method-of-test-unit-testcase&quot;&gt;
hacking the run method&lt;/a&gt;?&lt;/p&gt;
&lt;p&gt;The problem of add the clear method to Rails is that not all
cache storages support that method (for example disk store), so,
it's quite probable that they don't like that approach.&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2008-09-26T13:22:01-04:00</created-at>
      <creator-id type="integer">1016</creator-id>
      <diffable-attributes type="yaml">--- {}

</diffable-attributes>
      <milestone-id type="integer" nil="true"></milestone-id>
      <number type="integer">68</number>
      <permalink>testing-fragmentaction-cache-to-be-generated-or-expired</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">5807</project-id>
      <state>new</state>
      <tag>enhancement</tag>
      <title>Testing fragment/action cache to be generated or expired</title>
      <updated-at type="datetime">2008-09-26T13:22:03-04:00</updated-at>
      <user-id type="integer">1016</user-id>
      <user-name>Fernando Blat</user-name>
      <creator-name>Fernando Blat</creator-name>
      <assigned-user-name nil="true"></assigned-user-name>
      <url>http://thoughtbot.lighthouseapp.com/projects/5807/tickets/68</url>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer">17223</assigned-user-id>
      <attachments-count type="integer">2</attachments-count>
      <body>Hey Fernando,

We're moving over to Github issues: http://github.com/thoughtbot/shoulda/issues

If you want to take another shot at this, please resubmit this over there.

Thanks,
-Joe</body>
      <body-html>&lt;div&gt;&lt;p&gt;Hey Fernando,&lt;/p&gt;
&lt;p&gt;We're moving over to Github issues: &lt;a href=
&quot;http://github.com/thoughtbot/shoulda/issues&quot;&gt;http://github.com/thoughtbot/shoulda/issues&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;If you want to take another shot at this, please resubmit this
over there.&lt;/p&gt;
&lt;p&gt;Thanks,&lt;br&gt;
-Joe&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">true</closed>
      <created-at type="datetime">2009-06-09T19:51:20-04:00</created-at>
      <creator-id type="integer">1016</creator-id>
      <diffable-attributes type="yaml">--- 
:state: new
:assigned_user: 
</diffable-attributes>
      <milestone-id type="integer" nil="true"></milestone-id>
      <number type="integer">68</number>
      <permalink>testing-fragmentaction-cache-to-be-generated-or-expired</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">5807</project-id>
      <state>refused</state>
      <tag>enhancement</tag>
      <title>Testing fragment/action cache to be generated or expired</title>
      <updated-at type="datetime">2009-06-09T19:51:20-04:00</updated-at>
      <user-id type="integer">17223</user-id>
      <user-name>Joe Ferris</user-name>
      <creator-name>Fernando Blat</creator-name>
      <assigned-user-name>Joe Ferris</assigned-user-name>
      <url>http://thoughtbot.lighthouseapp.com/projects/5807/tickets/68</url>
    </version>
  </versions>
  <attachments type="array">
    <attachment type="Attachment">
      <code>df8b37fd641344be1a789e8996cdecfe3b55032e</code>
      <content-type>text/plain</content-type>
      <created-at type="datetime">2008-09-06T10:50:54-04:00</created-at>
      <filename>0001-Added-some-should-methods-for-testing-fragment-page.patch</filename>
      <height type="integer" nil="true"></height>
      <id type="integer">44213</id>
      <size type="integer">13037</size>
      <uploader-id type="integer">1016</uploader-id>
      <width type="integer" nil="true"></width>
      <url>http://thoughtbot.lighthouseapp.com/attachments/44213/0001-Added-some-should-methods-for-testing-fragment-page.patch</url>
    </attachment>
    <attachment type="Attachment">
      <code>61bdf28ab73914cdaef28e1a505b294ee533f9df</code>
      <content-type>text/plain</content-type>
      <created-at type="datetime">2008-09-10T11:44:00-04:00</created-at>
      <filename>cache_assertions.diff</filename>
      <height type="integer" nil="true"></height>
      <id type="integer">45067</id>
      <size type="integer">17444</size>
      <uploader-id type="integer">1016</uploader-id>
      <width type="integer" nil="true"></width>
      <url>http://thoughtbot.lighthouseapp.com/attachments/45067/cache_assertions.diff</url>
    </attachment>
  </attachments>
</ticket>
