spec/mocks/comment.rb in outoftime-sunspot-0.8.9 vs spec/mocks/comment.rb in outoftime-sunspot-0.9.0

- old
+ new

@@ -1,30 +1,19 @@ module Namespaced - class Comment < BaseClass - @@id = 0 - @@comments = [nil] - + class Comment < MockRecord attr_reader :id - attr_accessor :author_name, :published_at, :body, :average_rating + attr_accessor :author_name, :published_at, :body, :average_rating, :boost - def initialize(attrs = {}) - @id = @@id += 1 - @@comments << self - attrs.each_pair { |attribute, value| self.send("#{attribute}=", value) } + def custom_string + @custom_string ||= {} end - - def self.get(id) - @@comments[id] - end - - def self.get_all(ids) - ids.map { |id| get(id) }.sort_by { |post| post.id } # this is so that results are not ordered by coincidence - end end +end - Sunspot.setup(Comment) do - text :author_name, :body - string :author_name - time :published_at - integer :average_rating - end +Sunspot.setup(Namespaced::Comment) do + text :body, :author_name + string :author_name + time :published_at + integer :average_rating + dynamic_string :custom_string + boost :boost end