I’m pretty new to Rspec, so hope someone can help me out with this.
I’m leveraging a couple pre-existing applications in my current
project, both have fairly robust test suites in Rspec already.
However, one is using Rspec’s builit in mocking, and the other is
using mocha.
If I set config.mock_with mocha in spec_helper.rb, then all of the
rspec mocks fail. If I comment this out, all of the specs with mocha
fail.
Is there some way to set the mocking framework on a test and/or file
basis? I’ve been all over Google, and can’t seem to find a resolution
to this. I really don’t want to have to back through and rewrite
someone else’s test suite that is already working.
I guess I’ll try splitting them into separate directories. Will each
directory automatically include it’s own spec_helper.rb?
Are you using any features from one mock framework that aren’t present
in the other? If not, potentially you could, with some regexp prowess,
rewrite all the mocks of one mocking framework to conform to the syntax
of another.
Scott
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.