Limit the replacing of spec|app with app|spec to 1

If you had somewhere in your controllers/models another app folder it would still replace in the path.
Example:
controller: RAILS_ROOT/app/models/api/ **app** /device.rb
spec file would be: RAILS_ROOT/spec/models/api/ **spec** /device.rb