Refactor RSpec using shared_examples