background preloader

TEST

Facebook Twitter

Documentation for rspec-rails (2.12.2) Rspec-rails is a testing framework for Rails 3.x and 4.x. Use rspec-rails 1.x for Rails 2.x. Installation Add rspec-rails to both the :development and :test groups in the Gemfile: group :development, :test do gem 'rspec-rails', '~> 2.0'end Download and install by running: bundle install Initialize the spec/ directory (where specs will reside) with: rails generate rspec:install To run your specs, use the rspec command: bundle exec rspec bundle exec rspec spec/models bundle exec rspec spec/controllers/accounts_controller_spec.rb Specs can also be run via rake spec, though this command may be slower to start than the rspec command. In Rails 4, you may want to create a binstub for the rspec command so it can be run via bin/rspec: bundle binstubs rspec-core Generators Once installed, RSpec will generate spec files instead of Test::Unit test files when commands like rails generate model and rails generate controller are used.

You may also invoke invoke RSpec generators independently. Model Specs Upgrade note. RSpec | PeepCode Screencasts. ▶ We’ve been acquired by Pluralsight! ▶ Upgrade your account to Pluralsight ▶ More details… Filter by tag: Ruby on Rails · Ruby · Javascript · Play by Play · Unix · RSpec · Deployment · Pdf · Design · Cocoa · iPhone · Node · Databases · Productivity · Git RSpec 2: with Rails 4 and Ruby 2 (Part 3 of 3) RSpec 2: Tools (Part 2 of 3) RSpec 2: The Basics (Part 1 of 3) Use the Cucumber RSpec Controllers and Tools RSpec Mocks and Models RSpec Basics. Testing with RSpec. Ruby on Rails Screencasts. #275 How I Test. Here I show how I would add tests to the password reset feature created in the previous episode. I use RSpec, Capybara, Factory Girl, and Guard to make request, model, and mailer specs. Download: source codeProject Files in Zip (92.2 KB)mp4Full Size H.264 Video (26.4 MB)m4vSmaller H.264 Video (16.1 MB)webmFull Size VP8 Video (18.1 MB)ogvFull Size Theora Video (37.8 MB)

Better Specs. Rails Tutorial · Devise with RSpec and Cucumber. Devise with RSpec and Cucumber Introduction Ruby on Rails tutorial showing how to create a Rails 3.2 application using Devise with RSpec and Cucumber. Devise provides ready-made authentication and user management. RSpec is a popular framework for unit testing. Cucumber is used for integration testing and behavior driven development. The combination of Devise, RSpec, and Cucumber is the foundation for many real-world Rails applications. Is It for You? This tutorial is for experienced Rails developers as well as startup founders or hobbyist coders who are new to Rails. Experienced developers will find the complete application on GitHub; this tutorial provides the detail and background to understand the implementation in depth. For Rails beginners, this tutorial describes each step that you must follow to create the application. This is one in a series of Rails example apps and tutorials from the RailsApps Project.

This example application uses ActiveRecord and a SQLite database. Assumptions Fork.