Refactored code in post feature spec