Validate bookmark URL uniqueness

This commit is contained in:
2024-03-01 20:52:30 +11:00
parent 0f9b9c6248
commit 32411b76ef
3 changed files with 33 additions and 0 deletions

View File

@@ -176,6 +176,26 @@ RSpec.describe "Post creation", :db, :requests do
expect(post_repo.bookmark_listing.count).to eq 1
expect(post_repo.bookmark_listing.last.cached_content).to_not eq nil
end
it "validates an already bookmarked URL" do
params = {
h: "entry",
"bookmark-of": "http://example.com",
name: "Name",
content: "Content of the post",
cache: "true"
}
post "/micropub", params
expect(last_response).to be_successful
expect(post_repo.bookmark_listing.count).to eq 1
expect(post_repo.bookmark_listing.last.cached_content).to_not eq nil
post "/micropub", params
expect(last_response).to_not be_successful
expect(post_repo.bookmark_listing.count).to eq 1
end
end
context "checkins" do