RUBY-624 add #== and #hash methods + tests
RUBY-624 factor out some shared examples