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

Kurt ks at cissor.com
Thu Jan 13 13:36:50 EST 2011

Hi -- Thanks for sharing all your tips.  I couldn't understand your
line about what replaces have_text, however.  I don't see a method
called "matches" or "match"...

I think your list might be the start of an effort by users to document
RSpec2 the hard way, since a lot has changed that the core team has
not documented anywhere.  We've found that the Rails3 upgrade is some
work, but the advantages over Rails 2 are clear.  RSpec2, however, is
so poorly documented, useful features have been removed for no
apparent reason, and any advantages over RSpec1 have not become clear
yet (our test suite runs 3 times slower than it did in RSpec1!).

On Dec 4 2010, 3:22 pm, Jim Morris <wolfma... at gmail.com> wrote:
> I am trying to upgrade a Rails 2.2.2 app 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'
>   - changehave_textto 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 list
> rspec-us... at rubyforge.orghttp://rubyforge.org/mailman/listinfo/rspec-users

More information about the rspec-users mailing list