Refactor rspec tests

Change-Id: I4721cacff86a88ff360b7a3ede45464ff44e684d