background preloader

Ruby

Facebook Twitter

A Guide to Testing Rails Applications. 1 Why Write Tests for your Rails Applications? Rails makes it super easy to write your tests. It starts by producing skeleton test code while you are creating your models and controllers. By simply running your Rails tests you can ensure your code adheres to the desired functionality even after some major code refactoring. Rails tests can also simulate browser requests and thus you can test your application's response without having to test it through your browser. 2 Introduction to Testing Testing support was woven into the Rails fabric from the beginning. 2.1 The Test Environment By default, every Rails application has three environments: development, test, and production.

A dedicated test database allows you to set up and interact with test data in isolation. 2.2 Rails Sets up for Testing from the Word Go Rails creates a test folder for you as soon as you create a Rails project using rails new application_name. Fixtures are a way of organizing test data; they reside in the fixtures folder. Rack-legacy: A rack handler to run PHP/CGI alongside a Ruby/Rails App. #261 Testing JavaScript with Jasmine. Learning Ruby with the EdgeCase Ruby Koans.

RSpec