Skip to content

Commit

Permalink
Use selector to detect authenticity token input
Browse files Browse the repository at this point in the history
Rails 7.0 adds the autocomplete attribute to hidden fields. By
switching to a selector, we can test both Rails 6 and 7
  • Loading branch information
tagliala committed Dec 21, 2021
1 parent aedb879 commit b2a867d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion spec/rails/integration/forms_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
end

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

it "should create a label" do
Expand Down

0 comments on commit b2a867d

Please sign in to comment.