separated pool/post updates; fixed unit tests

This commit is contained in:
albert
2011-03-13 17:49:34 -04:00
parent 4717726217
commit 90a41a334b
13 changed files with 83 additions and 1334 deletions

View File

@@ -103,7 +103,7 @@ class ArtistTest < ActiveSupport::TestCase
should "have an associated wiki" do
user = Factory.create(:user)
artist = Factory.create(:artist, :name => "max", :wiki_page_attributes => {:body => "this is max"})
artist = Factory.create(:artist, :name => "max", :wiki_page_attributes => {:title => "xxx", :body => "this is max"})
assert_not_nil(artist.wiki_page)
assert_equal("this is max", artist.wiki_page.body)

View File

@@ -42,6 +42,10 @@ class PoolTest < ActiveSupport::TestCase
p1.add_pool(pool)
p2.add_pool(pool)
p3.add_pool(pool)
pool.add_post!(p1)
pool.add_post!(p2)
pool.add_post!(p3)
pool.reload
assert_equal("#{p1.id} #{p2.id} #{p3.id}", pool.post_ids)
assert_equal([p1.id, p2.id, p3.id], pool.post_id_array)
@@ -61,6 +65,10 @@ class PoolTest < ActiveSupport::TestCase
p1.add_pool(pool)
p2.add_pool(pool)
p3.add_pool(pool)
pool.add_post!(p1)
pool.add_post!(p2)
pool.add_post!(p3)
pool.reload
neighbors = pool.neighbor_posts(p1)
assert_nil(neighbors[:previous])
assert_equal(p2.id, neighbors[:next])

View File

@@ -16,6 +16,9 @@ module PostSets
@pool.add_post!(@post_2)
@pool.add_post!(@post_1)
@pool.add_post!(@post_3)
@post_2.add_pool(@pool)
@post_1.add_pool(@pool)
@post_3.add_pool(@pool)
@set = PostSets::Pool.new(@pool, :page => 1)
end