rewrite search feature to rspec