Refactor RSpec tests