Installing RSpec for Rails 3

Wed Apr 14 20:48:06 -0700 2010

Installing RSpec for Rails 3 was quite simple, here is a short guide to make sure you can also do it :)

For a Rails 3 app, simply edit the Gemfile and put this into the test section:

group :test do
  gem "rspec-rails",      ">= 2.0.0.beta"
  gem "autotest"
  gem "autotest-rails"
end

Then from your Rails root do:

$ bundle install

Once installed, you will need to tell RSpec to install itself:

 $ script/rails g rspec:install
       exist  lib
      create  lib/tasks/rspec.rake
       exist  config/initializers
      create  config/initializers/rspec_generator.rb
       exist  spec
      create  spec/spec_helper.rb
      create  autotest
      create  autotest/discover.rb

Then you should just be able to run Autotest:

 $ autotest
loading autotest/rails_rspec2
style: RailsRspec2
/Users/mikel/.rvm/rubies/ruby-1.8.7-p249/bin/ruby <snip>
........

Finished in 0.30205 seconds
8 examples, 0 failures

Nice.

blogLater

Mikel

  1. cyklinowanie tychy Says:

    Hi there,

    i love Rails, it’s simply and a lot of PHP and ZEND combination.

    Tom

  2. cyklinowanie tychy Says:

    Hi there,

    i love Rails, it’s simply and a lot of PHP and ZEND combination.

    Tom

  3. puterecom Says:

    On a related note. It seems the RSpec bundle for TextMate needs updating. The bundle’s spec file generator (shift+control+down_arrow) is inserting the spec stub code into the source file instead of the generated spec file.

  4. shingara Says:

    Rspec 2.0 is full compatible to Rails 3 ? or not now ?

  5. Sohan Says:

    Your post has been linked at the Drink Rails blog roll for the day.

  6. Jose Says:

    Thanks for the info.

    On a related note. It seems the RSpec bundle for TextMate needs updating. The bundle’s spec file generator (shift+control+down_arrow) is inserting the spec stub code into the source file instead of the generated spec file.

  7. PPC Management Company Says:

    I supposed that I almost perfectly knew Rails 3, but this source proved me that I had mistaken. So useful articles! So example, I have never heard that it is possible to install RSpec for Rails 3. Thanks a lot for sharing!

  8. daniel Says:

    Got this after following the steps:

    $ autotest
    loading autotest/rails_rspec2
    Error loading Autotest style autotest/rails_rspec2 (no such file to load — autotest/rails_rspec2). Aborting.

    help appriciated.

  9. SharePoint hosting Says:

    Sometimes, people need to be the right procedure installing. It happens because the installation will effect the performance. Then, people should read the guide in installing.

  10. Bluelock Says:

    I did not realize that this was simple. It is encouraging to see you guys doing this sort of thing. I will take a look and see if the benefits will be worthwhile for me. Thanks for posting these instructions.

  11. boys bikes Says:

    Such an amazing blog you have posted dear i like it and also suggesting it to my friends for visiting your blog because it has really admirable and informative data which provide us through your blog so i would like to thank you for sharing it with us and also appreciate you on this so keep it up.

  12. Mike Says:

    Want to know Rspec 2.0 is full compatible to Rails 3 ?

  13. boys bikes Says:

    Such an amazing blog you have posted dear i like it and also suggesting it to my friends for visiting your blog because it has really admirable and informative data which provide us through your blog so i would like to thank you for sharing it with us and also appreciate you on this so keep it up.

  14. simon Says:

    I am appreciating it very much! Looking forward to another great blog. Good luck to the author! all the best!
    chefs clothing

  15. how to become a pilot Says:

    About this topic, I have been lately in your blog once or twice now. I just wanted to say hi and show my thanks for the information provided.

  16. how to become a pilot Says:

    About this topic, I have been lately in your blog once or twice now. I just wanted to say hi and show my thanks for the information provided.

  17. dsfg5yfg Says:

    Such an amazing blog you have posted dear i like it and also suggesting it to my
    illuminati friends for visiting your blog because it has really admirable and informative data which provide us through How the illuminati work your blog so i would like to thank you for sharing it with us and also appreciate you on this so keep it up.

  18. ewanlewis Says:

    Hiee, I love your blogs layout and style of your articles. I will subscribe for your feed please keep posting! Big thanks for the useful information I found here.
    gold prices today

  19. Cosmetic Surgery San Diego Says:

    Easy tutorial on installing RSpec for Rails 3. Not very complex as I thought so. Thanks for the help.

  20. gundahkilawan Says:

    At times, your set up procedure is just not easy. Persons must sign up to perform the method. Therefore, they may acquire what they already want there after. Diablo 3 strategy guide reviews

  21. jamessmith Says:

    If you have anyone who is experienced with Access why not build your own system from the ground up? That allows for the reports you want, ease of use, and you can add on as you grow. charity auction items

  22. Alice Says:

    I’m hoping that those get populated before the job is complete, because aside from the page data, we’re using wikipedia categories to do a crude classification of entities, and pagelink data to construct a graph of pages and their connections. NYC pilates

  23. Brad Says:

    Perhaps the biggest advantage of rpsec over XUnit type unit testing is that I get to specify my object behavior prior to writing a single line of code for the object in something that looks, feels like English, which is something I’m fairly fluent in. criminal lawyer fort lauderdale

  24. jamessmith Says:

    If you have anyone who is experienced with Access why not build your own system from the ground up? That allows for the reports you want, ease of use, and you can add on as you grow. charity auction items

  25. emma Says:

    It is useful blog for everyone and i have got many new ideas and information with this blog. Thanks for sharing wonderful information.
    reverse address lookup

  26. caydenmiller Says:

    It is useful blog for everyone and i have got many new ideas and information with this blog. Thanks for sharing wonderful information.
    reverse address lookup

  27. Plagiarism Software Says:

    Wow, I love your site, big thank you to these ideas, and note in the first place that I fully agree with you! Let me emphasize, yes your article was excellent. I definitely enjoyed every little bit of it,

  28. Girl games online Says:

    Guidance is very useful for beginners. It helps them a lot to start their work properly.
    Girl games online

Leave a Reply