526 - Rails 3.1.0 Upgrade

This is a combination of 49 commits.
WIP Changed rails to 3.1.0 and upgraded rack_test to 0.6.1 which is required by rails 3.1.0

upgraded mysql2

removed debug_rjs settings because it's not used in rails 3.1

changed session store key

updated rspec-rails to 2.10.0

WIP need to pin point which one in spec_helper

526 - Fixed stack level too deep.

http://stackoverflow.com/questions/9475857/rspec-and-named-routes

526 - Fixed route based failure from content_item_spec.rb

526 - Added rails_autolink gem, because auto_link was removed as of rails 3.1

This is for migration purposes, a suggestion is to use Rinku.
http://apidock.com/rails/ActionView/Helpers/TextHelper/auto_link
http://rubygems.org/gems/rails_autolink

526 - Fixed Activity initialization method, due to change in rails 3.1

This initialization breaks in rails 3.1 because now it only accepts a hash, not an object like before.

526 - Fixed spec failure in issue_spec.rb

526 - Fixed managed_issue_page_spec.rb

Fixed error "Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true" when running managed_issue_page_spec.rb: 62

526 - Fixed failures on person_spec.rb has_key? method

 @person.errors.has_key? doesn't work. it should be @Person.errors.to_hash.has_key?

526 - Fixed "Person subscribed" related spec failure

526 - Fixed survey response spec.

cloning an active record doesn't instantiate a new object with a nil ID anymore.

526 - Fixed survey_spec.rb failure

In Rails 3.1. foreign_type now comes from Reflection#foreign_type not Reflection#options[:foreign_type].

526 - Fixed edit and new survey view specs .

For some reason stub_model doesn't work as expected.

526 - Fixed view specs on content_for failures.

view.instance_variable_get(:@content_for)[name] is now view.content_for(name.to_sym

526 - Fixed secure_url_helper_spec.rb

Made the SecureUrlHelper to include the Rails.application.routes.url_helpers because it acceses routes.

526 - Fixed views specs that has failure on finding the availability of form submit button.

As of Rails 3.1, The submit form helper does not generate an id “object_name_id” anymore.
http://guides.rubyonrails.org/3_1_release_notes.html

526 - Fixed suggest_facebook_auth.js.erb_spec.rb spec failure

526 - Fixed reflections/show.html failure, due to the render :partial iterates over all object within a collection which includes a "new_record" object.

This new record object causes the url and other avatar_image_url to fail, because it couldn't find the reflection_comment.person

526 - Marked a spec failure as pending on vote_confirmation.js.erb_spec.rb

Did some troubleshooting, wasn't able to solve why stub_template weirdly stubs the wrong  template

wip

526 - Changed stubbed_http_request.rb to be more permissive, because it's failing contribution_spec.rb and other models that uses embedly

526 - fixed curated_feed_item_pec.rb

610, 526 - Fixed vote_response_presenter_spec.rb

526 - Fixed vote_progress_service_spec.rb

Fixed the failures, as well as remove image_tag from the render_chart method in the VoteProgressService, in the future if a view wants to use this method, it needs to provide the image_tag itself.

526 - Added sets asset path to false, on application config.

526 - Fixed routing failures on admin widget_stats controller, by using the old rails :format

526 - Fixed actions controller spec failure

526 - Fixed content item links controller spec failure

526 - Fixed content items controller spec failures.

For an unknown reason, Hashes does not have indifferent access.

526 - Fixed various controller spec failures, due to parameters returning string, as opposed to integer.

526 - Fixed conversation controller spec failure

526 Fixed Admin surveys controller spec failures

526 - Fixed the contributions controller spec failures

526 - Fixed petitions controller spec failures

Changed stub_model to mock_model

526 - Fixed reflections controller spec failure

526 - Fixed Omniauth callback controller spec failure

Fixed the failure that was caused by an exception was raised when the person#save! in the link_with_facebook is called. We now catches the RecordNotSaved exception in the method itself.

526 - Fixed Surveys controller spec failure

526 - Fixed User controller spec failures

526 - Fixed Contribution tool acceptance test failures, due to changes in that rails 3.1 submit button doesn't create the same id as before.

526 - Fixed admin curated feed page object button based failures

526 - Fixed Forgot password page object button based failures

526 - Fixed User edit profile page object button based failures

526 - Fixed admin radioshow feature spec failures

526 - Fixed Unlinking Facebook account spec failures

526 - Gemfile.lock updated after rebase

526 - Fixed intermittent failures on profile presenter spec