Sunday, November 25, 2007

Announcements : Rails 1.2.6: Security and Maintenance Release

Ruby on Rails 1.2.6: Security and Maintenance Release has been released on November 24, 2007 by the rails core team to address a bug in the fix for session fixation attacks (CVE-2007-5380). The CVE Identifier for this new issue is CVE-2007-6077.

You should upgrade to this new release if you do not take specific session-fixation counter measures in your application. 1.2.6 also fixes some regressions when working with has_many associations on unsaved ActiveRecord objects.

As with other 1.2.x releases, this is intended as a drop in upgrade for users of earlier versions in the 1.2 series.

To upgrade, `gem install rails`, set RAILS_GEM_VERSION to ‘1.2.6’ in config/environment.rb, and `rake rails:update:configs`.

Sunday, November 18, 2007

Announcements : Aptana Radrails 0.9.1 Final Release

For Radrails users, there is happy news !

Aptana RadRails 0.9.1 Final Release has been released since 15th November 2007. Users who are still on 0.8.0 are highly recommended to upgrade.

Here's the Trac changelog: http://www.aptana.com/trac/milestone/RadRails%20IDE%200.9.1 And the ASAP one: http://support.aptana.com/issues/browse/ROR/fixforversion/10004

Saturday, November 10, 2007

Announcements : Rails 2.0 Release Candidate 1

Looks as if Rails 2.0 will be released soon if this post by DHH (creator of Rails) today at the Ruby on Rails : Talk Google Group is any indication :-

We're almost there. Really this time.
http://weblog.rubyonrails.org/2007/11/9/rails-2-0-release-candidate-1

BTW, the basic advice is to upgrade to 1.2.5 and get rid of all deprecation warnings.

Saturday, November 3, 2007

Advanced Rails : Testing a Ruby on Rails Application [Updated 30th August 2009]

Thanks to DHH and his team, Rails guides you to create a well-tested application by actively generating default test cases and setting up scripts and tools to run 3 different kinds of tests namely, unit testing, functional testing and integration testing.

For example, when you use script/generate to create your models and controllers, Rails also generates skeletal test files for you to flesh out with tests for your apps.

1) Unit Testing deals with tests on models.
2) Controllers are tested via Functional Testing
3) Integration Testing focuses on the testing of the interation between controllers

Rails has a number of features that make it easy to test your application. In particular, Rails uses a separate runtime database dedicated to testing and can automatically populate the test database with fresh sample data (that you provide) before each test.

This is how you execute the tests :-

a) Test all units and functionals
rake test

b) Run tests for functionals
rake test:functionals

c) Run tests for integration
rake test:integration

d) Run tests for units
rake test:units

Testing within Aptana RadRails
1) Select the Rails Project that is to be tested
2) Click the Tests Icon on the ToolBar Nb. Y0u have a choice to select All Tests, Unit Tests, Functional Tests and Integration Tests
3) If you select Unit Tests, you should see a dialog window showing progress with an option to run in the background.


4) On competion of the test, you should see the following result :-


Available assertions for rake test:units

assert_kind_of Class, @var # same class
assert @var # not nil
assert_equal 1, @p.id # equality

@product.destroy
assert_raise(ActiveRecord::RecordNotFound) { Customer.find( @customer.id ) }

Available assertions for rake test:functional

a) Requests

get :action # a get request of the specificed action

get :action, :id => 1,
{ session_hash }, # optional session variables
{ flash_hash } # optional messages in the flash
post :action, :foo => { :value1 => 'abc', :value2 => '123' },
{ :user_id => 17 },
{ :message => 'success' }
get, post, put, delete, head
assert_response :success

# possible parameters are:
# :success
# :redirect
# :missing
# :error


b) Redirects
assert_redirected_to :action => :other_action
assert_redirected_to :controller => 'foo', :action => 'bar'
assert_redirected_to http://crm4web.com.my/

c) Rendered with Template
assert_template "post/index"

d) Variable Assignments
assert_nil assigns(:some_variable)
assert_not_nil assigns(:some_variable)
assert_equal 11, assigns(:posts).size

e) Rendering of Specific Tags
assert_tag :tag => 'body'
assert_tag :content => 'Rails Plugins'
assert_tag :tag => 'div', :attributes => { :class => 'index_list' }
assert_tag :tag => 'head', :parent => { :tag => 'body' }
assert_tag :tag => 'html', :child => { :tag => 'head' }
assert_tag :tag => 'body', :descendant => { :tag => 'div' }
assert_tag :tag => 'ul',
:children => { :count => 1..3,
:only => { :tag => 'li' } }





More to come...

Welcome to Rails.. Rails... Rails !

In 1995, I started the popular Clipper...Clipper... Clipper website (no blogs then) which was very popular and linked by virtually every Clipper-related site. When I switched to Windows via Delphi in 1997, I started the Delphi... Delphi... Delphi site. In June 2007, I discovered Ruby on Rails and no prize for guessing what I am gonna name this blog. which I started on 2nd October 2007.

As at 10th June 2010, we have 13,364 unique visitors from more than 84 countries such as Angola, Andorra, Argentina, Australia, Austria, Algeria,Barbados, Bosnia and Herzogovina, Belgium, Brazil, Bulgaria, Bangladesh, Belarus, Bolivia, Chile, Cambodia, Cape Vede, Canada, China, Colombia, Costa Rica, Croatia, Cyprus, Czech Republic, Denmark, Egypt, Estonia, Finland, France, Guadeloupe, Guatemala, Germany, Greece, Hong Kong, Hungary, India, Indonesia, Ireland, Israel, Italy, Japan, Kenya, Korea, Lithuania, Latvia, Malaysia, Mexico, Macao, Netherlands, Nepal, Norway, New Zealand, Oman, Panama, Peru, Poland, Portugal,Paraguay , Philippines, Romania, Russian Federation, Saudi Arabia, Singapore, Spain, Slovakia, Slovenia, Serbia, South Korea, Slovenia, South Africa, Spain, Switzerland, Sri Lanka, Sweden, Taiwan, Thailand, Turkey, United Arab Emirates, Ukraine, USA, UK, Venezuela, Vietnam

CCH
10th June 2010, 19:42