improved rspec tests using shared examples