Skip to content

Commit b2a867d

Browse files
committed
Use selector to detect authenticity token input
Rails 7.0 adds the autocomplete attribute to hidden fields. By switching to a selector, we can test both Rails 6 and 7
1 parent aedb879 commit b2a867d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

spec/rails/integration/forms_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
end
2424

2525
it "should include the hidden authenticity token" do
26-
expect(html).to include '<input type="hidden" name="authenticity_token" value="AUTH_TOKEN" />'
26+
expect(html).to have_selector('input[type="hidden"][name="authenticity_token"][value="AUTH_TOKEN"]', visible: :hidden)
2727
end
2828

2929
it "should create a label" do

0 commit comments

Comments
 (0)