Add a describe block for the public file with content

Also add a comment about why it's hard to check for nil because of Rack.
This commit is contained in:
Greg Karékinian 2015-03-13 10:42:48 +01:00
parent a15635ce38
commit 3851a88c81

View File

@ -34,6 +34,7 @@ describe "App with Riak backend" do
end end
describe "GET public data" do describe "GET public data" do
describe "file with content" do
before do before do
object = data_bucket.new("jimmy:public:foo") object = data_bucket.new("jimmy:public:foo")
object.content_type = "text/plain" object.content_type = "text/plain"
@ -62,6 +63,7 @@ describe "App with Riak backend" do
last_response.status.must_equal 200 last_response.status.must_equal 200
last_response.headers["Expires"].must_equal "0" last_response.headers["Expires"].must_equal "0"
end end
end
describe "empty file" do describe "empty file" do
before do before do
@ -75,7 +77,11 @@ describe "App with Riak backend" do
it "returns an empty body" do it "returns an empty body" do
last_response.status.must_equal 200 last_response.status.must_equal 200
last_response.body.must_equal "" # Rack::MockRequest turns the body into a string. We can't use
# `last_response.body` to check for nil, because:
# >> [nil].join
# => ""
last_response.body.must_equal ''
last_response.headers["Content-Length"].must_equal '0' last_response.headers["Content-Length"].must_equal '0'
end end
end end