refactor rspec using shared_examples