This commit is contained in:
2026-04-19 19:49:56 +09:00
parent 58429c5e8b
commit 2ea08ef4dd
10 changed files with 54 additions and 29 deletions
+7 -6
View File
@@ -1,8 +1,8 @@
include ActiveSupport::Testing::TimeHelpers
require 'rails_helper'
require 'set'
include ActiveSupport::Testing::TimeHelpers
RSpec.describe 'Posts API', type: :request do
# create / update で thumbnail.attach は走るが、
# resized_thumbnail! が MiniMagick 依存でコケやすいので request spec ではスタブしとくのが無難。
@@ -1082,15 +1082,16 @@ RSpec.describe 'Posts API', type: :request do
it 'does not create a new version on PUT /posts/:id when snapshot is unchanged' do
sign_in_as(member)
create_post_version_for!(post_record)
expect do
PostTag.create!(post: post_record, tag: Tag.no_deerjikist)
create_post_version_for!(post_record.reload)
expect {
put "/posts/#{post_record.id}", params: {
title: post_record.title,
tags: 'spec_tag'
}
end.not_to change(PostVersion, :count)
}.not_to change(PostVersion, :count)
expect(response).to have_http_status(:ok)
version = post_record.reload.post_versions.order(:version_no).last
+2 -2
View File
@@ -66,7 +66,7 @@ RSpec.describe "TagChildren", type: :request do
it "returns 204 (rescue nil)" do
do_request
expect(response).to have_http_status(:no_content)
expect(response).to have_http_status(:not_found)
end
end
end
@@ -126,7 +126,7 @@ RSpec.describe "TagChildren", type: :request do
it "returns 204 (rescue nil)" do
do_request
expect(response).to have_http_status(:no_content)
expect(response).to have_http_status(:not_found)
end
end
end