diff --git a/lib/remote_storage/riak.rb b/lib/remote_storage/riak.rb index 94be481..df0b4c7 100644 --- a/lib/remote_storage/riak.rb +++ b/lib/remote_storage/riak.rb @@ -108,7 +108,7 @@ module RemoteStorage new_object_size = object.raw_data.size end - response = object.store + object.store log_count = object_exists ? 0 : 1 log_operation(user, directory, log_count, new_object_size, existing_object_size) diff --git a/spec/riak_spec.rb b/spec/riak_spec.rb index d908150..65bbfae 100644 --- a/spec/riak_spec.rb +++ b/spec/riak_spec.rb @@ -369,13 +369,23 @@ describe "App with Riak backend" do last_response.body.must_equal @image end - # it "indexes the binary set" do - # indexes = binary_bucket.get("jimmy:documents:jaypeg").indexes - # indexes["user_id_bin"].must_be_kind_of Set - # indexes["user_id_bin"].must_include "jimmy" + it "responds with an ETag header" do + last_response.headers["ETag"].wont_be_nil + etag = last_response.headers["ETag"] - # indexes["directory_bin"].must_include "documents" - # end + get "/jimmy/documents/jaypeg" + + last_response.headers["ETag"].wont_be_nil + last_response.headers["ETag"].must_equal etag + end + + it "changes the ETag when updating the file" do + old_etag = last_response.headers["ETag"] + put "/jimmy/documents/jaypeg", @image + + last_response.headers["ETag"].wont_be_nil + last_response.headers["ETag"].wont_equal old_etag + end it "logs the operation" do objects = [] @@ -409,14 +419,6 @@ describe "App with Riak backend" do last_response.status.must_equal 200 last_response.body.must_equal @image end - - # it "indexes the binary set" do - # indexes = binary_bucket.get("jimmy:documents:jaypeg").indexes - # indexes["user_id_bin"].must_be_kind_of Set - # indexes["user_id_bin"].must_include "jimmy" - - # indexes["directory_bin"].must_include "documents" - # end end end