Rspec issue loading files twice


I am trying to add rspec to my existing project. My rails version is
4.2.1, ruby is 2.3.1. and rspec is 3.0.4. Now I have an issue when
running the rspec that is all routes and files under config/initailzer
are executed twice which produces an error(Already initialized route). I
am using a gem ‘mailboxer’ in the poject. I think the issue happens when
the lib/mailboxer/engine.rb is executed The content of the file is exact
same as in
The issue goes, when I delete the file and test works fine. Can anyone
suggest a solution for this problem. Thanks in advance