Refactor device spec