improve Rspec test code