test: send the etag back as a browser would
The staged card has no row in the store to read an etag off, so the
import tests scrape it from the form — where the attribute spells the
quotes an etag wears as entities. Posting those back matched nothing
and every save in the walk was refused as stale.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KrREeoPLXx1qsYYq7qkL8h
diff --git a/test/pro_tacts/admin/test_import_pages.rb b/test/pro_tacts/admin/test_import_pages.rb
index 025b388..4a898fa 100644
--- a/test/pro_tacts/admin/test_import_pages.rb
+++ b/test/pro_tacts/admin/test_import_pages.rb
@@ -55,9 +55,12 @@ class AdminImportPagesTest < Minitest::Test
last_response.headers["location"].to_s[%r{/import/([a-z]+)}, 1]
end
- # The snapshot guard the editor's form carries, so a test's save
- # reads like the browser's.
- def etag = last_response.body[/name="etag" value="([^"]+)"/, 1]
+ # The snapshot guard the editor's form carries, read off the page
+ # rather than out of the store, a staged contact having no row
+ # there yet. An etag wears quotes (RFC 9110 section 8.8.3) and the
+ # attribute spells them as entities; a browser sends back the
+ # quotes themselves.
+ def etag = last_response.body[/name="etag" value="([^"]+)"/, 1].to_s.gsub(""", '"')
def test_the_screen_asks_for_a_vcf
get "/import"