* meta_search now pulls directly from GitHub

* Updated gems
* [inprogress] New pagination helpers used instead of pagination presenters
* [inprogress] Favorites refactored to use ActiveRecord
* [inprogress] PostSets refactored to use a decorator/dependency injection pattern
* [inprogress] Made pool/post interaction more robust
* Pool#posts now returns an ActiveRelation object
* Fixed unit tests
This commit is contained in:
albert
2011-06-07 17:34:09 -04:00
parent 435d3bf6e2
commit 49b3d43ddd
17 changed files with 248 additions and 136 deletions

View File

@@ -356,20 +356,31 @@ class PostTest < ActiveSupport::TestCase
end
context "Pools:" do
context "Removing a post from a pool" do
should "update the post's pool string" do
post = Factory.create(:post)
pool = Factory.create(:pool)
post.add_pool!(pool)
post.remove_pool!(pool)
post.reload
assert_equal("", post.pool_string)
post.remove_pool!(pool)
post.reload
assert_equal("", post.pool_string)
end
end
context "Adding a post to a pool" do
should "update the post's pool string" do
post = Factory.create(:post)
pool = Factory.create(:pool)
post.add_pool(pool)
post.add_pool!(pool)
post.reload
assert_equal("pool:#{pool.id}", post.pool_string)
post.add_pool(pool)
post.add_pool!(pool)
post.reload
assert_equal("pool:#{pool.id}", post.pool_string)
post.remove_pool(pool)
post.reload
assert_equal("", post.pool_string)
post.remove_pool(pool)
post.remove_pool!(pool)
post.reload
assert_equal("", post.pool_string)
end
@@ -474,7 +485,7 @@ class PostTest < ActiveSupport::TestCase
post2 = Factory.create(:post)
post3 = Factory.create(:post)
pool = Factory.create(:pool)
post1.add_pool(pool)
post1.add_pool!(pool)
relation = Post.tag_match("pool:#{pool.name}")
assert_equal(1, relation.count)
assert_equal(post1.id, relation.first.id)