Hi, I am in a situation where I am going to have to rewrite a working Ruby on Rails application in CakePHP with PHP5. I have a whole bunch of specs written with rspec, and I was wondering if it would be possible to somehow use these specs to test the Models and Controllers that I am rewriting in CakePHP. I am going to be basically just exactly duplicating the Rails application, with identical class and method names in PHP. I know this is perverse, but is it possible? Thanks, sness.
I''ll take a shot at answering this. rSpec doesn''t passively observe the code under test, it actively interrogates it. So rSpec, which is written in Ruby will not be mappable into the PHP space. Consider this example: assigns[:person].first_name.should == ''bob'' Here''s a snippet of controller spec that is reaching into the controller and checking out the contents of @person. See why it won''t work? Have a look at this: http://www.sitepoint.com/forums/showthread.php?t=439480 Still want to work in PHP? Maybe? On Jan 30, 2007, at 7:27 PM, sness wrote:> Hi, > > I am in a situation where I am going to have to rewrite a working Ruby > on Rails application in CakePHP with PHP5. I have a whole bunch of > specs written with rspec, and I was wondering if it would be possible > to somehow use these specs to test the Models and Controllers that I > am rewriting in CakePHP. I am going to be basically just exactly > duplicating the Rails application, with identical class and method > names in PHP. > > I know this is perverse, but is it possible? > > Thanks, > sness. > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users
Why actually doing a rewrite of a RoR application? Performance? I bet there are other solutions. On 1/31/07, s.ross <cwdinfo at gmail.com> wrote:> I''ll take a shot at answering this. rSpec doesn''t passively observe > the code under test, it actively interrogates it. So rSpec, which is > written in Ruby will not be mappable into the PHP space. Consider > this example: > > assigns[:person].first_name.should == ''bob'' > > Here''s a snippet of controller spec that is reaching into the > controller and checking out the contents of @person. See why it won''t > work? > > Have a look at this: > > http://www.sitepoint.com/forums/showthread.php?t=439480 > > Still want to work in PHP? > > Maybe? > > > On Jan 30, 2007, at 7:27 PM, sness wrote: > > > Hi, > > > > I am in a situation where I am going to have to rewrite a working Ruby > > on Rails application in CakePHP with PHP5. I have a whole bunch of > > specs written with rspec, and I was wondering if it would be possible > > to somehow use these specs to test the Models and Controllers that I > > am rewriting in CakePHP. I am going to be basically just exactly > > duplicating the Rails application, with identical class and method > > names in PHP. > > > > I know this is perverse, but is it possible? > > > > Thanks, > > sness. > > _______________________________________________ > > 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 >