mirror of
https://github.com/discourse/discourse-solved.git
synced 2025-05-26 01:49:15 +00:00
Related: - https://github.com/discourse/discourse-solved/pull/309 - https://github.com/discourse/discourse-solved/pull/341 Requires: - https://github.com/discourse/discourse/pull/31954 This commit converts all use of post and topic custom fields into a dedicated table: - migration for copying custom field into table - swap app usage of custom fields to table This commit does not attempt to fix issues or optimise, and does not delete old data from custom fields _yet_.
24 lines
694 B
Ruby
24 lines
694 B
Ruby
# frozen_string_literal: true
|
|
|
|
require "rails_helper"
|
|
|
|
describe DiscourseSolved::TopicAnswerMixin do
|
|
let(:topic) { Fabricate(:topic) }
|
|
let(:post) { Fabricate(:post, topic: topic) }
|
|
let(:guardian) { Guardian.new }
|
|
|
|
before { Fabricate(:solved_topic, topic: topic, answer_post: post) }
|
|
|
|
it "should have true for `has_accepted_answer` field in each serializer" do
|
|
[
|
|
TopicListItemSerializer,
|
|
SearchTopicListItemSerializer,
|
|
SuggestedTopicSerializer,
|
|
UserSummarySerializer::TopicSerializer,
|
|
].each do |serializer|
|
|
json = serializer.new(topic, scope: guardian, root: false).as_json
|
|
expect(json[:has_accepted_answer]).to be_truthy
|
|
end
|
|
end
|
|
end
|