test/fixtures/poro.rb in cheap_ams-0.10.5 vs test/fixtures/poro.rb in cheap_ams-0.10.6
- old
+ new
@@ -5,11 +5,11 @@
def self.model_name
@_model_name ||= ActiveModel::Name.new(self)
end
- def initialize(hash={})
+ def initialize(hash = {})
@attributes = hash
end
def cache_key
"#{self.class.name.downcase}/#{self.id}-#{self.updated_at.strftime("%Y%m%d%H%M%S%9N")}"
@@ -57,21 +57,17 @@
end
class ProfileSerializer < ActiveModel::Serializer
attributes :name, :description
- urls :posts, :comments
-
def arguments_passed_in?
options[:my_options] == :accessible
end
end
class ProfilePreviewSerializer < ActiveModel::Serializer
attributes :name
-
- urls :posts, :comments
end
Post = Class.new(Model)
Like = Class.new(Model)
Author = Class.new(Model)
@@ -81,31 +77,30 @@
User = Class.new(Model)
Location = Class.new(Model)
Place = Class.new(Model)
Tag = Class.new(Model)
VirtualValue = Class.new(Model)
-Comment = Class.new(Model) do
+Comment = Class.new(Model) do
# Uses a custom non-time-based cache key
def cache_key
"#{self.class.name.downcase}/#{self.id}"
end
end
module Spam; end
Spam::UnrelatedLink = Class.new(Model)
PostSerializer = Class.new(ActiveModel::Serializer) do
- cache key:'post', expires_in: 0.1, skip_digest: true
+ cache key: 'post', expires_in: 0.1, skip_digest: true
attributes :id, :title, :body
has_many :comments
belongs_to :blog
belongs_to :author
- url :comments
def blog
- Blog.new(id: 999, name: "Custom blog")
+ Blog.new(id: 999, name: 'Custom blog')
end
def custom_options
options
end
@@ -131,11 +126,11 @@
options
end
end
AuthorSerializer = Class.new(ActiveModel::Serializer) do
- cache key:'writer', skip_digest: true
+ cache key: 'writer', skip_digest: true
attribute :id
attribute :name
has_many :posts
has_many :roles
@@ -247,11 +242,11 @@
end
VirtualValueSerializer = Class.new(ActiveModel::Serializer) do
attributes :id
- has_many :reviews, virtual_value: [{id: 1}, {id: 2}]
- has_one :maker, virtual_value: {id: 1}
+ has_many :reviews, virtual_value: [{ id: 1 }, { id: 2 }]
+ has_one :maker, virtual_value: { id: 1 }
def reviews
end
def maker