Notes posted by bfcapell
RSS feed![Default_avatar_30](https://www.gravatar.com/avatar/cea2fe41ffb1ca1fd9b00899d2e8ad13?default=http://apidock.com/images/default_avatar_30.png&size=30)
3 thanks
Interpolating
Note that to interpolate, the sequences must be inside single quotes:
# replace /ll/ with itself 'hello'.gsub(/ll/, '\0') # returns 'hello' 'hello'.gsub(/ll/, "\0") # returns 'he\000o'
![Default_avatar_30](https://www.gravatar.com/avatar/cea2fe41ffb1ca1fd9b00899d2e8ad13?default=http://apidock.com/images/default_avatar_30.png&size=30)
4 thanks
Using html text instead of default response
If you have a string containing html and want to assert_select against it, as the doc states you have to pass in an element (HTML::Node) as the first argument. You can do something like this:
doc = HTML::Document.new('<p><span>example</span></p>') assert_select doc.root, 'span'
![Default_avatar_30](https://www.gravatar.com/avatar/cea2fe41ffb1ca1fd9b00899d2e8ad13?default=http://apidock.com/images/default_avatar_30.png&size=30)
2 thanks
Escape brackets in selector
If you need to escape brackets in a selector, this is the way to do it:
assert_select "input[type=hidden][name='user[role_ids][]']"