@@ -227,6 +227,15 @@ def decode(str); @calls << :decode; JSON.parse(str); end
227
227
response [ "Set-Cookie" ] . must_match /SameSite=None/i
228
228
end
229
229
230
+ it "does not create new cookies if cookies does not change" do
231
+ response = response_for ( app : incrementor )
232
+ cookie = response [ "Set-Cookie" ]
233
+ cookie . must_include "rack.session="
234
+ response = response_for ( app : only_session_id , cookie : cookie )
235
+ cookie = response [ "Set-Cookie" ]
236
+ cookie . must_be_nil
237
+ end
238
+
230
239
it "allows using a lambda to specify same_site option, because some browsers require different settings" do
231
240
# Details of why this might need to be set dynamically:
232
241
# https://www.chromium.org/updates/same-site/incompatible-clients
@@ -253,14 +262,16 @@ def decode(str); @calls << :decode; JSON.parse(str); end
253
262
response = response_for ( app : incrementor )
254
263
cookie = response [ 'Set-Cookie' ]
255
264
response = response_for ( app : only_session_id , cookie : cookie )
256
- cookie = response [ 'Set-Cookie' ] if response [ 'Set-Cookie' ]
265
+ response [ 'Set-Cookie' ] . must_be_nil
257
266
258
267
response . body . wont_equal ""
259
268
old_session_id = response . body
260
269
261
270
response = response_for ( app : renewer , cookie : cookie )
262
- cookie = response [ 'Set-Cookie' ] if response [ 'Set-Cookie' ]
263
- response = response_for ( app : only_session_id , cookie : cookie )
271
+ new_cookie = response [ 'Set-Cookie' ]
272
+ new_cookie . wont_equal cookie
273
+
274
+ response = response_for ( app : only_session_id , cookie : new_cookie )
264
275
265
276
response . body . wont_equal ""
266
277
response . body . wont_equal old_session_id
@@ -276,7 +287,6 @@ def decode(str); @calls << :decode; JSON.parse(str); end
276
287
response = response_for ( app : destroy_session , cookie : response )
277
288
response = response_for ( app : only_session_id , cookie : response )
278
289
279
- response . body . wont_equal ""
280
290
response . body . wont_equal old_session_id
281
291
end
282
292
0 commit comments