Skip to content

Commit 315b26e

Browse files
committed
Add tests for renaming behaviour in TopicsMutator
1 parent 8f642fb commit 315b26e

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

spec/services/topics/mutator_spec.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
[
2525
ActiveStorage::Blob.create_and_upload!(
2626
io: StringIO.new("dummy content"),
27-
filename: "dummy.pdf",
27+
filename: "rename_dummy.pdf",
2828
content_type: "application/pdf",
2929
).signed_id,
3030
]
@@ -41,6 +41,7 @@
4141
document_id: created_topic.documents.first.id,
4242
action: "update",
4343
)
44+
expect(created_topic.reload.documents.first.blob.filename.to_s).to eq("#{created_topic.id}_prefix_2023_1_dummy.pdf")
4445
end
4546
end
4647

@@ -87,6 +88,10 @@
8788
expect(updated_topic).to be_persisted
8889
expect(updated_topic.description).to eq("many topic details")
8990
end
91+
92+
it "does not rename existing documents" do
93+
expect { subject.update }.not_to change { topic.reload.documents.first.blob.filename.to_s }.from("test_image.png")
94+
end
9095
end
9196
end
9297

0 commit comments

Comments
 (0)