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:
<input type="submit" value="save" />
Moving the button to the inside of the form will fix the issue.
I found a weird quick in Ruby best explained by the fact it’s written by a Japanese dude. Nerd post below. In Ruby, when you compare two time signatures, you use the operator:
It compares two Time objects and then returns -1, 0, +1, or nil. So this is how it looks in practice:
comparison_result = today_time <=> yesterday_time
What’s the value of “comparison_result?” The answer is 1. 1? I stared at this for a long time and my inclination was to think it should return whichever side was bigger. There was very little documentation I could find on this topic, but I finally figured out why.
The reason WHY is that time flows down or backwards in Asian culture, and Ruby is written by a Japanese dude. Confirmation in this wiki article.
So the conclusion is that this operator should be read as, “Which side is smaller?” As in: left side = -1, right side = +1, 0 = same, and nil = invalid.