Respond with 409 on naming collisions between documents and folders

This commit is contained in:
Garret Alfert
2014-09-23 17:59:28 +02:00
parent 1603d3d2ff
commit 8e355ba532
2 changed files with 54 additions and 0 deletions

View File

@@ -302,6 +302,32 @@ describe "App with Riak backend" do
end
end
describe "naming collissions between documents and directories" do
before do
put "/jimmy/documents/archive/document", "lorem ipsum"
end
it "responds with 409 when directory with same name already exists" do
put "/jimmy/documents/archive", "some awesome content"
last_response.status.must_equal 409
lambda {
data_bucket.get("jimmy:documents/archive")
}.must_raise Riak::HTTPFailedRequest
end
it "responds with 409 when there is an existing document with same name as one of the directories" do
put "/jimmy/documents/archive/document/subdir/doc", "some awesome content"
last_response.status.must_equal 409
lambda {
data_bucket.get("jimmy:documents/archive/document/subdir/doc")
}.must_raise Riak::HTTPFailedRequest
end
end
describe "with existing content" do
before do
put "/jimmy/documents/archive/foo", "lorem ipsum"