finished dmails and favorites functional tests

This commit is contained in:
albert
2010-12-05 22:27:45 -05:00
parent b18f6340e7
commit 46164eab4f
25 changed files with 226 additions and 48 deletions

View File

@@ -13,6 +13,10 @@ class Favorite
# ignore
end
def self.count(user_id)
select_value_sql("SELECT COUNT(*) FROM #{table_name_for(user_id)}").to_i
end
def self.destroy(conditions)
if conditions[:user_id] && conditions[:post_id]
destroy_for_post_and_user(conditions[:post_id], conditions[:user_id])

View File

@@ -1,6 +1,6 @@
module PostSets
class Base
attr_accessor :page, :before_id, :count
attr_accessor :page, :before_id, :count, :posts
def initialize(options = {})
@page = options[:page].to_i

View File

@@ -1,10 +1,10 @@
module PostSets
class FavoriteSet < Base
class Favorite < Base
attr_accessor :user
def initialize(options = {})
super(options)
def initialize(user)
@user = user
super()
end
def tags
@@ -12,7 +12,11 @@ module PostSets
end
def load_posts
user.favorite_posts(:before_id => before_id)
@posts = user.favorite_posts(:before_id => before_id)
end
def limit
Danbooru.config.posts_per_page
end
end
end