@@ -81,35 +81,34 @@ def check_dir_listing_content_type(content_type)
81
81
end
82
82
end
83
83
84
- describe "PUT another JSON object" do
84
+ describe "updating that JSON object" do
85
85
before do
86
86
@old_outer_listing_res = do_get_request ( "#{ CONFIG [ :category ] } /" )
87
- @old_listing_res = do_get_request ( "#{ CONFIG [ :category ] } /some-other- subdir/" )
88
- @res = do_put_request ( "#{ CONFIG [ :category ] } /some-other- subdir/test-object-simple .json" ,
89
- '{"new ": "object "}' ,
87
+ @old_listing_res = do_get_request ( "#{ CONFIG [ :category ] } /some-subdir/" )
88
+ @res = do_put_request ( "#{ CONFIG [ :category ] } /some-subdir/nested-folder-object .json" ,
89
+ '{"foo ": "bam "}' ,
90
90
{ content_type : "application/json" } )
91
91
@outer_listing_res = do_get_request ( "#{ CONFIG [ :category ] } /" )
92
- @listing_res = do_get_request ( "#{ CONFIG [ :category ] } /some-other- subdir/" )
92
+ @listing_res = do_get_request ( "#{ CONFIG [ :category ] } /some-subdir/" )
93
93
94
94
@item_etag = @res . headers [ :etag ]
95
95
@old_listing = JSON . parse @old_listing_res . body
96
96
@listing = JSON . parse @listing_res . body
97
- @item_info = @listing [ "items" ] [ "test-object-simple .json" ]
98
- @old_item_info = @old_listing [ "items" ] [ "test-object-simple .json" ]
97
+ @item_info = @listing [ "items" ] [ "nested-folder-object .json" ]
98
+ @old_item_info = @old_listing [ "items" ] [ "nested-folder-object .json" ]
99
99
end
100
100
101
101
it "works" do
102
+ # before runs for each block once, so we have to put all blocks into one
102
103
[ 200 , 201 ] . must_include @res . code
103
104
@item_etag . wont_be_nil
104
105
@item_etag . must_be_etag
105
- end
106
106
107
- it " updates the file etag in the listing" do
107
+ # updates the file etags in the folder listing
108
108
@item_info [ "ETag" ] . must_equal @item_etag . delete ( '"' )
109
109
@item_info [ "ETag" ] . wont_equal @old_item_info [ "ETag" ]
110
- end
111
110
112
- it " updates the folder etag" do
111
+ # updates the folder etag
113
112
@listing_res . headers [ :etag ] . wont_equal @old_outer_listing_res . headers [ :etag ]
114
113
@outer_listing_res . headers [ :etag ] . wont_equal @old_outer_listing_res . headers [ :etag ]
115
114
end
@@ -348,8 +347,8 @@ def check_dir_listing_content_type(content_type)
348
347
end
349
348
350
349
it "contains the correct items" do
351
- @listing [ "items" ] . length . must_equal 6
352
- [ "Capture d'écran.jpg" , "my-list" , "some-subdir/" , "some-other-subdir/" ,
350
+ @listing [ "items" ] . length . must_equal 5
351
+ [ "Capture d'écran.jpg" , "my-list" , "some-subdir/" ,
353
352
"test-object-simple.json" , "test-object-simple2.json" ] . each do |key |
354
353
@listing [ "items" ] . keys . must_include key
355
354
end
@@ -624,9 +623,8 @@ def check_dir_listing_content_type(content_type)
624
623
625
624
describe "DELETE objects" do
626
625
it "works" do
627
- [ "test-object-simple.json" , "some-other-subdir/test-object-simple.json" ,
628
- "Capture d'écran.jpg" , "some-subdir/nested-folder-object.json" ,
629
- "my-list" ] . each do |key |
626
+ [ "test-object-simple.json" , "Capture d'écran.jpg" ,
627
+ "some-subdir/nested-folder-object.json" , "my-list" ] . each do |key |
630
628
res = do_delete_request ( "#{ CONFIG [ :category ] } /#{ key } " )
631
629
632
630
res . code . must_equal 200
0 commit comments