remove useless regexp subexpression
use rspec let to remove duplicate code