Hi, 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. Thanks in advance for your help, Val
David Chelimsky
2009-Mar-15 05:01 UTC
[rspec-users] How to use different mocking frameworks?
On Sat, Mar 14, 2009 at 8:37 PM, Val <vagostino at gmail.com> wrote:> Hi, > > 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?Nope. Gotta pick one or the other. Reason - diff mock frameworks invade Object in diff ways - mixing and matching is dangerous to your health.> 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. > > Thanks in advance for your help, > Val > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
David Chelimsky
2009-Mar-15 05:01 UTC
[rspec-users] How to use different mocking frameworks?
On Sun, Mar 15, 2009 at 12:01 AM, David Chelimsky <dchelimsky at gmail.com> wrote:> On Sat, Mar 14, 2009 at 8:37 PM, Val <vagostino at gmail.com> wrote: >> Hi, >> >> 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? > > Nope. Gotta pick one or the other. Reason - diff mock frameworks > invade Object in diff ways - mixing and matching is dangerous to your > health.I mean within one project. Of course you can use rspec/mocks in one, mocha in another, flexmock and rr in others.> >> 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. >> >> Thanks in advance for your help, >> Val >> _______________________________________________ >> rspec-users mailing list >> rspec-users at rubyforge.org >> http://rubyforge.org/mailman/listinfo/rspec-users >> >
Andrew Premdas
2009-Mar-15 12:38 UTC
[rspec-users] How to use different mocking frameworks?
Would it be possible to split the tests into separate runs - a bit like having two different run configurations with cucumber? 2009/3/15 David Chelimsky <dchelimsky at gmail.com>> On Sun, Mar 15, 2009 at 12:01 AM, David Chelimsky <dchelimsky at gmail.com> > wrote: > > On Sat, Mar 14, 2009 at 8:37 PM, Val <vagostino at gmail.com> wrote: > >> Hi, > >> > >> 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? > > > > Nope. Gotta pick one or the other. Reason - diff mock frameworks > > invade Object in diff ways - mixing and matching is dangerous to your > > health. > > I mean within one project. Of course you can use rspec/mocks in one, > mocha in another, flexmock and rr in others. > > > > >> 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. > >> > >> Thanks in advance for your help, > >> Val > >> _______________________________________________ > >> rspec-users mailing list > >> rspec-users at rubyforge.org > >> http://rubyforge.org/mailman/listinfo/rspec-users > >> > > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20090315/c8259833/attachment-0001.html>
David Chelimsky
2009-Mar-15 13:09 UTC
[rspec-users] How to use different mocking frameworks?
On Sun, Mar 15, 2009 at 7:38 AM, Andrew Premdas <apremdas at gmail.com> wrote:> Would it be possible to split the tests into separate runs - a bit like > having two different run configurations with cucumber?If you split the specs w/ rspec-mocks and those w/ mocha in separate dirs, you could run them each manually. Or you could create rake tasks to do it.> > 2009/3/15 David Chelimsky <dchelimsky at gmail.com> >> >> On Sun, Mar 15, 2009 at 12:01 AM, David Chelimsky <dchelimsky at gmail.com> >> wrote: >> > On Sat, Mar 14, 2009 at 8:37 PM, Val <vagostino at gmail.com> wrote: >> >> Hi, >> >> >> >> 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? >> > >> > Nope. Gotta pick one or the other. Reason - diff mock frameworks >> > invade Object in diff ways - mixing and matching is dangerous to your >> > health. >> >> I mean within one project. Of course you can use rspec/mocks in one, >> mocha in another, flexmock and rr in others. >> >> > >> >> 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. >> >> >> >> Thanks in advance for your help, >> >> Val >> >> _______________________________________________ >> >> rspec-users mailing list >> >> rspec-users at rubyforge.org >> >> http://rubyforge.org/mailman/listinfo/rspec-users >> >> >> > >> _______________________________________________ >> rspec-users mailing list >> rspec-users at rubyforge.org >> http://rubyforge.org/mailman/listinfo/rspec-users > > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
Okay. Thanks for your responses. I guess I''ll try splitting them into separate directories. Will each directory automatically include it''s own spec_helper.rb? On Mar 15, 6:09?am, David Chelimsky <dchelim... at gmail.com> wrote:> On Sun, Mar 15, 2009 at 7:38 AM, Andrew Premdas <aprem... at gmail.com> wrote: > > Would it be possible to split the tests into separate runs - a bit like > > having two different run configurations with cucumber? > > If you split the specs w/ rspec-mocks and those w/ mocha in separate > dirs, you could run them each manually. Or you could create rake tasks > to do it. > > > > > > > 2009/3/15 David Chelimsky <dchelim... at gmail.com> > > >> On Sun, Mar 15, 2009 at 12:01 AM, David Chelimsky <dchelim... at gmail.com> > >> wrote: > >> > On Sat, Mar 14, 2009 at 8:37 PM, Val <vagost... at gmail.com> wrote: > >> >> Hi, > > >> >> 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? > > >> > Nope. Gotta pick one or the other. Reason - diff mock frameworks > >> > invade Object in diff ways - mixing and matching is dangerous to your > >> > health. > > >> I mean within one project. Of course you can use rspec/mocks in one, > >> mocha in another, flexmock and rr in others. > > >> >> 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. > > >> >> Thanks in advance for your help, > >> >> Val > >> >> _______________________________________________ > >> >> rspec-users mailing list > >> >> rspec-us... at rubyforge.org > >> >>http://rubyforge.org/mailman/listinfo/rspec-users > > >> _______________________________________________ > >> rspec-users mailing list > >> rspec-us... at rubyforge.org > >>http://rubyforge.org/mailman/listinfo/rspec-users > > > _______________________________________________ > > rspec-users mailing list > > rspec-us... at rubyforge.org > >http://rubyforge.org/mailman/listinfo/rspec-users > > _______________________________________________ > rspec-users mailing list > rspec-us... at rubyforge.orghttp://rubyforge.org/mailman/listinfo/rspec-users
David Chelimsky
2009-Mar-15 22:13 UTC
[rspec-users] How to use different mocking frameworks?
On Sun, Mar 15, 2009 at 1:51 PM, Val <vagostino at gmail.com> wrote:> Okay. ?Thanks for your responses. > > I guess I''ll try splitting them into separate directories. ?Will each > directory automatically include it''s own spec_helper.rb?Not sure I understand that question. You''re going to be manually splitting things up, right?> > On Mar 15, 6:09?am, David Chelimsky <dchelim... at gmail.com> wrote: >> On Sun, Mar 15, 2009 at 7:38 AM, Andrew Premdas <aprem... at gmail.com> wrote: >> > Would it be possible to split the tests into separate runs - a bit like >> > having two different run configurations with cucumber? >> >> If you split the specs w/ rspec-mocks and those w/ mocha in separate >> dirs, you could run them each manually. Or you could create rake tasks >> to do it. >> >> >> >> >> >> > 2009/3/15 David Chelimsky <dchelim... at gmail.com> >> >> >> On Sun, Mar 15, 2009 at 12:01 AM, David Chelimsky <dchelim... at gmail.com> >> >> wrote: >> >> > On Sat, Mar 14, 2009 at 8:37 PM, Val <vagost... at gmail.com> wrote: >> >> >> Hi, >> >> >> >> 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? >> >> >> > Nope. Gotta pick one or the other. Reason - diff mock frameworks >> >> > invade Object in diff ways - mixing and matching is dangerous to your >> >> > health. >> >> >> I mean within one project. Of course you can use rspec/mocks in one, >> >> mocha in another, flexmock and rr in others. >> >> >> >> 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. >> >> >> >> Thanks in advance for your help, >> >> >> Val >> >> >> _______________________________________________ >> >> >> rspec-users mailing list >> >> >> rspec-us... at rubyforge.org >> >> >>http://rubyforge.org/mailman/listinfo/rspec-users >> >> >> _______________________________________________ >> >> rspec-users mailing list >> >> rspec-us... at rubyforge.org >> >>http://rubyforge.org/mailman/listinfo/rspec-users >> >> > _______________________________________________ >> > rspec-users mailing list >> > rspec-us... at rubyforge.org >> >http://rubyforge.org/mailman/listinfo/rspec-users >> >> _______________________________________________ >> rspec-users mailing list >> rspec-us... at rubyforge.orghttp://rubyforge.org/mailman/listinfo/rspec-users > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
Val wrote:> Okay. Thanks for your responses. > > 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> On Mar 15, 6:09 am, David Chelimsky <dchelim... at gmail.com> wrote: > >> On Sun, Mar 15, 2009 at 7:38 AM, Andrew Premdas <aprem... at gmail.com> wrote: >> >>> Would it be possible to split the tests into separate runs - a bit like >>> having two different run configurations with cucumber? >>> >> If you split the specs w/ rspec-mocks and those w/ mocha in separate >> dirs, you could run them each manually. Or you could create rake tasks >> to do it. >> >> >> >> >> >> >>> 2009/3/15 David Chelimsky <dchelim... at gmail.com> >>> >>>> On Sun, Mar 15, 2009 at 12:01 AM, David Chelimsky <dchelim... at gmail.com> >>>> wrote: >>>> >>>>> On Sat, Mar 14, 2009 at 8:37 PM, Val <vagost... at gmail.com> wrote: >>>>> >>>>>> Hi, >>>>>> >>>>>> 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? >>>>>> >>>>> Nope. Gotta pick one or the other. Reason - diff mock frameworks >>>>> invade Object in diff ways - mixing and matching is dangerous to your >>>>> health. >>>>> >>>> I mean within one project. Of course you can use rspec/mocks in one, >>>> mocha in another, flexmock and rr in others. >>>> >>>>>> 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. >>>>>> >>>>>> Thanks in advance for your help, >>>>>> Val >>>>>> _______________________________________________ >>>>>> rspec-users mailing list >>>>>> rspec-us... at rubyforge.org >>>>>> http://rubyforge.org/mailman/listinfo/rspec-users >>>>>> >>>> _______________________________________________ >>>> rspec-users mailing list >>>> rspec-us... at rubyforge.org >>>> http://rubyforge.org/mailman/listinfo/rspec-users >>>> >>> _______________________________________________ >>> rspec-users mailing list >>> rspec-us... at rubyforge.org >>> http://rubyforge.org/mailman/listinfo/rspec-users >>> >> _______________________________________________ >> rspec-users mailing list >> rspec-us... at rubyforge.orghttp://rubyforge.org/mailman/listinfo/rspec-users >> > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >