spec/models/user.rb in simple_cacheable-1.4.1 vs spec/models/user.rb in simple_cacheable-1.5.0

- old
+ new

@@ -8,19 +8,55 @@ has_one :group, through: :account model_cache do with_key with_attribute :login - with_method :last_post + with_method :last_post, :bad_iv_name!, :bad_iv_name?, :admin?, :hash_with_class_key with_association :posts, :account, :images, :group - with_class_method :default_name + with_class_method :default_name, :user_with_id, :user_with_email, + :users_with_ids, :users_with_ids_in, :user_with_attributes end def last_post posts.last end def self.default_name "flyerhzm" end + def bad_iv_name! + 42 + end + + def bad_iv_name? + 44 + end + + def admin? + false + end + + def hash_with_class_key + {:foo => "Bar", :class => "batman"} + end + + # accepts a number + def self.user_with_id(id) + User.find(id) + end + + # accepts a string + def self.user_with_email(email) + User.find_by_email(email) + end + + # accepts an array + def self.users_with_ids(ids) + User.find(ids) + end + + # accepts a range + def self.users_with_ids_in(range) + User.select { |u| range.include?(u.id) } + end end