Permalink
Browse files

Resetting the gemspec info, removing automatic loading of the test he…

…lper, but adding details about it (and related contributors Lars and Joel) to the README.
  • Loading branch information...
1 parent 7849d4e commit 5101f1e4621c853c9e999ffe01d3fa3be44f6773 @pat committed May 12, 2010
Showing with 14 additions and 12 deletions.
  1. +10 −2 README.textile
  2. +0 −5 lib/after_commit.rb
  3. +4 −5 tasks/distribution.rb
View
@@ -4,7 +4,7 @@ An ActiveRecord/Rails library to add @before_commit@, @after_commit@, @before_ro
h2. Installation
-<pre><code>gem install after_commit --source http://gemcutter.org</code></pre>
+<pre><code>gem install after_commit</code></pre>
h2. Usage
@@ -35,6 +35,13 @@ You can use these just like you would any other callback:
end
end</code></pre>
+h2. In Tests
+
+Keep in mind that transactions are finicky at best in tests, and so there's a helper module to make @after_commit@ play nicely in your testing context. You'll need to add these two lines to your spec/test helper:
+
+<pre><code>ActiveRecord::Base.send(:include, AfterCommit::AfterSavepoint)
+ActiveRecord::Base.include_after_savepoint_extensions</code></pre>
+
h2. Credits
This code first appeared in a blog post "by Eli Miller":http://elimiller.blogspot.com/2007/06/proper-cache-expiry-with-aftercommit.html, and was then included in "Thinking Sphinx":http://ts.freelancing-gods.com by "Pat Allan":http://freelancing-gods.com, with modifications from Joost Hietbrink. The code was then "put on GitHub as a plugin":http://github.com/GUI/after_commit by Nick Muerdter, and many people forked and added their own contributions.
@@ -50,4 +57,5 @@ This version (maintained by Pat Allan) includes the following patches:
* before_* callbacks ("Trotter Cashion":http://trottercashion.com/)
* Gemspec and extended tests, works as a plugin, doesn't load ActiveRecord hooks twice, doesn't add Test environment hook automatically. ("David Yip":http://github.com/yipdw)
* Exception propagation ("George Ogata":http://github.com/oggy/)
-* Keeping callbacks focused on the correct transactions ("Benjamin Stein":http://benjaminste.in/)
+* Keeping callbacks focused on the correct transactions ("Benjamin Stein":http://benjaminste.in/)
+* Using savepoints for test helper ("Lars Klevan":http://www.linkedin.com/in/larsklevan and "Joel Chippindale":http://blog.monkeysthumb.org/)
View
@@ -68,8 +68,3 @@ def self.collection(collection, connection)
ActiveRecord::Base.send(:include, AfterCommit::ActiveRecord)
ActiveRecord::Base.include_after_commit_extensions
-
-if defined?(RAILS_ENV) && RAILS_ENV == 'test'
- ActiveRecord::Base.send(:include, AfterCommit::AfterSavepoint)
- ActiveRecord::Base.include_after_savepoint_extensions
-end
View
@@ -11,15 +11,14 @@
end
Jeweler::Tasks.new do |gem|
- gem.name = 'larsklevan-after_commit'
+ gem.name = 'after_commit'
gem.summary = 'after_commit callback for ActiveRecord'
gem.description = %Q{
A Ruby on Rails plugin to add an after_commit callback. This can be used to trigger methods only after the entire transaction is complete.
- Updated with savepoint support for unit testing.
}
- gem.email = "tastybyte@gmail.com"
- gem.homepage = "http://github.com/larsklevan/after_commit"
- gem.authors = ["Nick Muerdter", "David Yip", "Pat Allan", "Lars Klevan"]
+ gem.email = "pat@freelancing-gods.com"
+ gem.homepage = "http://github.com/freelancing-god/after_commit"
+ gem.authors = ["Nick Muerdter", "David Yip", "Pat Allan"]
gem.files = FileList[
'lib/**/*.rb',

0 comments on commit 5101f1e

Please sign in to comment.