Use millisecond resolution for timestamps (refs #17)

This commit is contained in:
2012-10-23 18:09:55 +02:00
parent 9c93c83ceb
commit b8138a29f1
3 changed files with 46 additions and 10 deletions

View File

@@ -39,6 +39,11 @@ describe "Directories" do
last_response.status.must_equal 200
last_response.headers["Last-Modified"].wont_be_nil
now = Time.now
last_modified = DateTime.parse(last_response.headers["Last-Modified"])
last_modified.year.must_equal now.year
last_modified.day.must_equal now.day
end
it "has CORS headers set" do
@@ -116,7 +121,7 @@ describe "Directories" do
object = data_bucket.get("jimmy:tasks/private/projects/world-domination:start")
directory = directory_bucket.get("jimmy:tasks")
directory.data.to_i.must_equal object.last_modified.to_i
directory.data.to_i.must_equal object.meta['timestamp'][0].to_i
end
end
end
@@ -182,7 +187,7 @@ describe "Directories" do
directory = directory_bucket.get("jimmy:tasks/home")
directory.data.wont_be_nil
directory.data.to_i.must_equal object.last_modified.to_i
directory.data.to_i.must_equal object.meta['timestamp'][0].to_i
end
it "sets the correct index for the directory object" do
@@ -221,7 +226,7 @@ describe "Directories" do
object = data_bucket.get("jimmy:tasks/home:trash")
directory = directory_bucket.get("jimmy:tasks/home")
directory.data.to_i.must_equal object.last_modified.to_i
directory.data.to_i.must_equal object.meta['timestamp'][0].to_i
end
end
end

View File

@@ -14,14 +14,24 @@ describe "App with Riak backend" do
object.content_type = "text/plain"
object.data = "some text data"
object.store
get "/jimmy/public/foo"
end
it "returns the value on all get requests" do
get "/jimmy/public/foo"
last_response.status.must_equal 200
last_response.body.must_equal "some text data"
end
it "has a Last-Modified header set" do
last_response.status.must_equal 200
last_response.headers["Last-Modified"].wont_be_nil
now = Time.now
last_modified = DateTime.parse(last_response.headers["Last-Modified"])
last_modified.year.must_equal now.year
last_modified.day.must_equal now.day
end
end
describe "GET data with custom content type" do