2015-10-11 05:41:23 -04:00
|
|
|
require 'rails_helper'
|
2013-10-28 00:55:27 -04:00
|
|
|
require_dependency 'post_action'
|
|
|
|
|
|
|
|
describe TopicListItemSerializer do
|
|
|
|
|
|
|
|
it "correctly serializes topic" do
|
|
|
|
date = Time.zone.now
|
|
|
|
|
|
|
|
topic = Topic.new
|
|
|
|
topic.title = "test"
|
|
|
|
topic.created_at = date - 2.minutes
|
|
|
|
topic.bumped_at = date
|
|
|
|
topic.posters = []
|
|
|
|
serialized = TopicListItemSerializer.new(topic, scope: Guardian.new, root: false).as_json
|
|
|
|
|
2014-12-31 09:55:03 -05:00
|
|
|
expect(serialized[:title]).to eq("test")
|
|
|
|
expect(serialized[:bumped]).to eq(true)
|
2013-10-28 00:55:27 -04:00
|
|
|
end
|
|
|
|
end
|