DEV: Block accidental serialization of entire AR models (#27668)

This commit is contained in:
Jan Cernik
2024-07-01 17:08:48 -03:00
committed by GitHub
parent 1ae902fa60
commit 6599b85a75
19 changed files with 98 additions and 45 deletions

View File

@@ -108,6 +108,11 @@ RSpec.describe "notifications" do
response "200", "notifications marked read" do
schema type: :object, properties: { success: { type: :string } }
let(:notification) do
notification = Fabricate(:notification)
NotificationSerializer.new(notification).as_json
end
run_test!
end
end

View File

@@ -221,7 +221,10 @@ RSpec.describe "posts" do
expected_response_schema = load_spec_schema("topic_create_response")
schema expected_response_schema
let(:params) { Fabricate(:post) }
let(:params) do
post = Fabricate(:post)
post.serializable_hash(only: %i[topic_id raw created_at]).as_json
end
it_behaves_like "a JSON endpoint", 200 do
let(:expected_response_schema) { expected_response_schema }