Rearrange permissions_spec.rb

This commit is contained in:
galfert 2012-10-29 10:09:53 +01:00
parent 4a723f26fb
commit 6541b97997

View File

@ -8,8 +8,8 @@ describe "Permissions" do
purge_all_buckets
end
describe "public data" do
describe "GET" do
context "public data" do
before do
object = data_bucket.new("jimmy:public:foo")
object.content_type = "text/plain"
@ -38,10 +38,8 @@ describe "Permissions" do
last_response.body.must_equal "some text data"
end
end
end
describe "private data" do
describe "GET" do
context "private data" do
before do
object = data_bucket.new("jimmy:documents:foo")
object.content_type = "text/plain"
@ -65,7 +63,7 @@ describe "Permissions" do
header "Authorization", "Bearer 123"
end
describe "when authorized" do
context "when authorized" do
it "returns the value for a key in a top-level directory" do
get "/jimmy/documents/foo"
@ -81,7 +79,7 @@ describe "Permissions" do
end
end
describe "when not authorized" do
context "when not authorized" do
it "returns a 403 for a key in a top-level directory" do
get "/jimmy/confidential/bar"
@ -89,6 +87,7 @@ describe "Permissions" do
end
end
end
end
describe "PUT" do
before do
@ -99,7 +98,7 @@ describe "Permissions" do
header "Authorization", "Bearer 123"
end
describe "to a top-level directory" do
context "to a top-level directory" do
it "saves the value when there are write permissions" do
put "/jimmy/contacts/1", "John Doe"
@ -114,7 +113,7 @@ describe "Permissions" do
end
end
describe "to a sub-directory" do
context "to a sub-directory" do
it "saves the value when there are direct write permissions" do
put "/jimmy/tasks/home/1", "take out the trash"
@ -146,7 +145,7 @@ describe "Permissions" do
header "Authorization", "Bearer 123"
end
describe "when authorized" do
context "when authorized" do
before do
object = data_bucket.new("jimmy:tasks:1")
object.content_type = "text/plain"
@ -178,7 +177,7 @@ describe "Permissions" do
end
end
describe "when not authorized" do
context "when not authorized" do
before do
object = data_bucket.new("jimmy:documents:private")
object.content_type = "text/plain"
@ -204,7 +203,6 @@ describe "Permissions" do
end
end
end
end
describe "global permissions" do
before do
@ -214,7 +212,7 @@ describe "Permissions" do
object.store
end
describe "write all" do
context "write all" do
before do
auth = auth_bucket.new("jimmy:123")
auth.data = [":rw", "documents:r"]
@ -279,7 +277,7 @@ describe "Permissions" do
end
end
describe "read all" do
context "read all" do
before do
auth = auth_bucket.new("jimmy:123")
auth.data = [":r", "contacts:rw"]