[rspec-users] Notes on upgrading from RSpec 1 to RSpec 2

David Chelimsky dchelimsky at gmail.com
Tue Feb 1 18:17:57 EST 2011


On Feb 1, 2011, at 4:23 PM, Kurt wrote:

> I've started a chart of differences between RSpec 1 and 2 here:
> http://snyderscribbles.blogspot.com/2011/01/rspec-2-changes-from-rspec-1.html
> 
> I'll gladly post any new discoveries anyone want to contribute.

It would be great if you would contribute these directly to RSpec's docs so everyone can find them and benefit from them. Take a look at:

http://relishapp.com/rspec/rspec-core/v/2-4/file/upgrade
http://relishapp.com/rspec/rspec-rails/v/2-4/file/upgrade

They are just Markdown files, maintained in the rspec projects:

https://github.com/rspec/rspec-core/blob/master/features/Upgrade.md
https://github.com/rspec/rspec-rails/blob/master/features/Upgrade.md

Just submit pull requests and I'll be happy to merge them.

Cheers,
David

> On Dec 4 2010, 3:22 pm, Jim Morris <wolfma... at gmail.com> wrote:
>> I am trying to upgrade a Rails 2.2.2app to Rails3, its  a pain ;)
>> 
>> Part of this is I need to upgrade all my Specs to RSpec2, as this info
>> does not seem to be in any one place, here is a summary of what I
>> needed to do...
>> 
>> * needed to rename all my views from .haml to .html.haml,
>> (or .html.erb) although
>>   Rails3 seemed ok with the old naming RSpec2 view specs failed to
>> find the templates with the old name.
>> 
>> * rewrite all my view specs...
>>   - change `... at controller.template.` to `view.`
>> 
>>   -  change `have_tag` to `have_selector` and change the parameters
>>      - place holders not supported, need to use #{}
>>      - add :content => for any text in second parameter
>> 
>>   - change `assign[:blah]= :blod` to `assign(:blag, :blod)`
>> 
>>   - change the describe ... do to have the path to the view rather
>> than text description
>> 
>>   - change the render '/show' to just render or render :file => 'full
>> template spec'
>> 
>>   - change have_text to matches(/../)
>> 
>>   - change response.should to rendered.shoul
>> 
>> * modify the controller specs
>>   - controller_name is no longer supported, so need to nest all my
>>     describes under a top level describe that has the controller
>> name.
>>      describe 'UsersController' do
>>      or use subject {SomeController.new}  (not tested yet)
>> 
>>    - when using post/delete/put :something, :id => 1 passing in an
>> integer id used to work, now it needs to
>>      be a string (probably a rails3 thing)
>>      delete :destroy, :id => "1"
>> 
>> * helper specs only needed minor changes
>>   - change have_tag to have_selector
>> 
>> _______________________________________________rspec-users mailing listrspec-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



More information about the rspec-users mailing list