Refactor RSpec test