When trying to use click_button on a button in a form, if you get this error:
undefined method `node_name' for nil:NilClass
Check that the button is inside a form. As in, the following code will cause this error:
HTML:
<form></form>
<input type="submit" value="save" />
Capybara:
click_button "save"
Moving the button to the inside of the form will fix the issue.