fix tests, implement limits for favorites
This commit is contained in:
@@ -782,7 +782,6 @@ class Post < ActiveRecord::Base
|
|||||||
update_parent_on_destroy
|
update_parent_on_destroy
|
||||||
# decrement_tag_post_counts
|
# decrement_tag_post_counts
|
||||||
update_column(:parent_id, nil)
|
update_column(:parent_id, nil)
|
||||||
Post.expire_cache_for_all(tag_array)
|
|
||||||
|
|
||||||
unless options[:without_mod_action]
|
unless options[:without_mod_action]
|
||||||
ModAction.create(:description => "deleted post ##{id}")
|
ModAction.create(:description => "deleted post ##{id}")
|
||||||
|
|||||||
@@ -461,15 +461,13 @@ class User < ActiveRecord::Base
|
|||||||
end
|
end
|
||||||
|
|
||||||
def favorite_limit
|
def favorite_limit
|
||||||
return nil
|
if is_privileged?
|
||||||
|
20_000
|
||||||
# if is_privileged?
|
elsif is_platinum?
|
||||||
# 20_000
|
nil
|
||||||
# elsif is_platinum?
|
else
|
||||||
# nil
|
4_000
|
||||||
# else
|
end
|
||||||
# 4_000
|
|
||||||
# end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -61,8 +61,8 @@ class PostTest < ActiveSupport::TestCase
|
|||||||
assert_equal(1, Post.fast_count)
|
assert_equal(1, Post.fast_count)
|
||||||
assert_equal(1, Post.fast_count("aaa"))
|
assert_equal(1, Post.fast_count("aaa"))
|
||||||
post.delete!
|
post.delete!
|
||||||
assert_equal(0, Post.fast_count)
|
assert_equal(1, Post.fast_count)
|
||||||
assert_equal(0, Post.fast_count("aaa"))
|
assert_equal(1, Post.fast_count("aaa"))
|
||||||
end
|
end
|
||||||
|
|
||||||
should "toggle the is_deleted flag" do
|
should "toggle the is_deleted flag" do
|
||||||
@@ -72,11 +72,11 @@ class PostTest < ActiveSupport::TestCase
|
|||||||
assert_equal(true, post.is_deleted?)
|
assert_equal(true, post.is_deleted?)
|
||||||
end
|
end
|
||||||
|
|
||||||
should "decrement the tag counts" do
|
should "not decrement the tag counts" do
|
||||||
post = FactoryGirl.create(:post, :tag_string => "aaa")
|
post = FactoryGirl.create(:post, :tag_string => "aaa")
|
||||||
assert_equal(1, Tag.find_by_name("aaa").post_count)
|
assert_equal(1, Tag.find_by_name("aaa").post_count)
|
||||||
post.delete!
|
post.delete!
|
||||||
assert_equal(0, Tag.find_by_name("aaa").post_count)
|
assert_equal(1, Tag.find_by_name("aaa").post_count)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user