samedi 27 août 2016

Rails: Can I test for the presence of a button_to?

My site had dozens of instances of "link_to". I decided to change most of them to "button_to" for better appearance. The lines of my test that used to check for the presence of those links are no good anymore.

assert_select "a", :href => user_path(@seminar.teacher), text: "Your Teacher Profile", count: 2

The test doesn't work correctly with

assert_select "button", etc...

Is there a way to adjust the test to find the button_to instances? From my initial searches, it seems like there isn't.

I'm also considering simply cutting those lines from the tests, since I've read in another article that simply testing for the presence of display items isn't a very useful way to use rails tests.

Thanks in advance for any insight!

Aucun commentaire:

Enregistrer un commentaire