XHR with an Integration test

Create the application.

/home/rubys/git/rails/railties/bin/rails new depot
      create  
      create  README
      create  Rakefile
      create  config.ru
      create  .gitignore
      create  Gemfile
      create  app
      create  app/assets/images/rails.png
      create  app/assets/javascripts/application.js
      create  app/assets/stylesheets/application.css
      create  app/controllers/application_controller.rb
      create  app/helpers/application_helper.rb
      create  app/mailers
      create  app/models
      create  app/views/layouts/application.html.erb
      create  app/mailers/.gitkeep
      create  app/models/.gitkeep
      create  config
      create  config/routes.rb
      create  config/application.rb
      create  config/environment.rb
      create  config/environments
      create  config/environments/development.rb
      create  config/environments/production.rb
      create  config/environments/test.rb
      create  config/initializers
      create  config/initializers/backtrace_silencers.rb
      create  config/initializers/inflections.rb
      create  config/initializers/mime_types.rb
      create  config/initializers/secret_token.rb
      create  config/initializers/session_store.rb
      create  config/initializers/wrap_parameters.rb
      create  config/locales
      create  config/locales/en.yml
      create  config/boot.rb
      create  config/database.yml
      create  db
      create  db/seeds.rb
      create  doc
      create  doc/README_FOR_APP
      create  lib
      create  lib/tasks
      create  lib/tasks/.gitkeep
      create  lib/assets
      create  lib/assets/.gitkeep
      create  log
      create  log/.gitkeep
      create  public
      create  public/404.html
      create  public/422.html
      create  public/500.html
      create  public/favicon.ico
      create  public/index.html
      create  public/robots.txt
      create  script
      create  script/rails
      create  test/fixtures
      create  test/fixtures/.gitkeep
      create  test/functional
      create  test/functional/.gitkeep
      create  test/integration
      create  test/integration/.gitkeep
      create  test/unit
      create  test/unit/.gitkeep
      create  test/performance/browsing_test.rb
      create  test/test_helper.rb
      create  tmp/cache
      create  tmp/cache/assets
      create  vendor/assets/stylesheets
      create  vendor/assets/stylesheets/.gitkeep
      create  vendor/plugins
      create  vendor/plugins/.gitkeep
         run  bundle install
Using rake (0.9.2) 
Using multi_json (1.0.3) 
Using activesupport (3.1.0.rc4) 
Using bcrypt-ruby (2.1.4) 
Using builder (3.0.0) 
Using i18n (0.6.0) 
Using activemodel (3.1.0.rc4) 
Using erubis (2.7.0) 
Using rack (1.3.1) 
Using rack-cache (1.0.2) 
Using rack-mount (0.8.1) 
Using rack-test (0.6.0) 
Using hike (1.1.0) 
Using tilt (1.3.2) 
Using sprockets (2.0.0.beta.10) 
Using tzinfo (0.3.29) 
Using actionpack (3.1.0.rc4) 
Using mime-types (1.16) 
Using polyglot (0.3.1) 
Using treetop (1.4.9) 
Using mail (2.3.0) 
Using actionmailer (3.1.0.rc4) 
Using braintree (2.10.1) 
Using activemerchant (1.15.0) 
Using arel (2.1.3) 
Using activerecord (3.1.0.rc4) 
Using activeresource (3.1.0.rc4) 
Using ansi (1.3.0) 
Using bundler (1.0.15) 
Using highline (1.6.2) 
Using net-ssh (2.1.4) 
Using net-scp (1.0.4) 
Using net-sftp (2.0.5) 
Using net-ssh-gateway (1.1.0) 
Using capistrano (2.6.0) 
Using coffee-script-source (1.1.1) 
Using execjs (1.2.0) 
Using coffee-script (2.2.0) 
Using rack-ssl (1.3.2) 
Using rdoc (3.8) 
Using thor (0.14.6) 
Using railties (3.1.0.rc4) 
Using coffee-rails (3.1.0.rc.5) 
Using haml (3.1.2) 
Using htmlentities (4.3.0) 
Using jquery-rails (1.0.12) 
Using mysql (2.8.1) 
Using rails (3.1.0.rc4) 
Using sass (3.1.4) 
Using sass-rails (3.1.0.rc.4) 
Using sqlite3 (1.3.3) 
Using test-unit (2.3.0) 
Using turn (0.8.2) 
Using uglifier (1.0.0) 
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
bundle install
Using rake (0.9.2) 
Using multi_json (1.0.3) 
Using activesupport (3.1.0.rc4) 
Using bcrypt-ruby (2.1.4) 
Using builder (3.0.0) 
Using i18n (0.6.0) 
Using activemodel (3.1.0.rc4) 
Using erubis (2.7.0) 
Using rack (1.3.1) 
Using rack-cache (1.0.2) 
Using rack-mount (0.8.1) 
Using rack-test (0.6.0) 
Using hike (1.1.0) 
Using tilt (1.3.2) 
Using sprockets (2.0.0.beta.10) 
Using tzinfo (0.3.29) 
Using actionpack (3.1.0.rc4) 
Using mime-types (1.16) 
Using polyglot (0.3.1) 
Using treetop (1.4.9) 
Using mail (2.3.0) 
Using actionmailer (3.1.0.rc4) 
Using braintree (2.10.1) 
Using activemerchant (1.15.0) 
Using arel (2.1.3) 
Using activerecord (3.1.0.rc4) 
Using activeresource (3.1.0.rc4) 
Using ansi (1.3.0) 
Using bundler (1.0.15) 
Using highline (1.6.2) 
Using net-ssh (2.1.4) 
Using net-scp (1.0.4) 
Using net-sftp (2.0.5) 
Using net-ssh-gateway (1.1.0) 
Using capistrano (2.6.0) 
Using coffee-script-source (1.1.1) 
Using execjs (1.2.0) 
Using coffee-script (2.2.0) 
Using rack-ssl (1.3.2) 
Using rdoc (3.8) 
Using thor (0.14.6) 
Using railties (3.1.0.rc4) 
Using coffee-rails (3.1.0.rc.5) 
Using haml (3.1.2) 
Using htmlentities (4.3.0) 
Using jquery-rails (1.0.12) 
Using mysql (2.8.1) 
Using rails (3.1.0.rc4) 
Using sass (3.1.4) 
Using sass-rails (3.1.0.rc.4) 
Using sqlite3 (1.3.3) 
Using test-unit (2.3.0) 
Using turn (0.8.2) 
Using uglifier (1.0.0) 
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.

Generate our first model and associated scaffolding

rails generate scaffold product
      invoke  active_record
      create    db/migrate/20110716123623_create_products.rb
      create    app/models/product.rb
      invoke    test_unit
      create      test/unit/product_test.rb
      create      test/fixtures/products.yml
       route  resources :products
      invoke  scaffold_controller
      create    app/controllers/products_controller.rb
      invoke    erb
      create      app/views/products
      create      app/views/products/index.html.erb
      create      app/views/products/edit.html.erb
      create      app/views/products/show.html.erb
      create      app/views/products/new.html.erb
      create      app/views/products/_form.html.erb
      invoke    test_unit
      create      test/functional/products_controller_test.rb
      invoke    helper
      create      app/helpers/products_helper.rb
      invoke      test_unit
      create        test/unit/helpers/products_helper_test.rb
      invoke  assets
      invoke    coffee
      create      app/assets/javascripts/products.js.coffee
      invoke    scss
      create      app/assets/stylesheets/products.css.scss
      invoke  scss
      create    app/assets/stylesheets/scaffolds.css.scss

Migrate

rake db:migrate
mv 20110716123623_create_products.rb 20110711000001_create_products.rb
==  CreateProducts: migrating =================================================
-- create_table(:products)
   -> 0.0015s
==  CreateProducts: migrated (0.0016s) ========================================
 
edit test/integration/user_stories_test.rb
require 'test_helper'
class ProductIntegrationTest < ActionDispatch::IntegrationTest
  test 'xhr' do
    xml_http_request :post, '/products', :id => 1
  end
end

Integration Test

rake --trace test:integration
** Invoke test:integration (first_time)
** Invoke test:prepare (first_time)
** Invoke db:test:prepare (first_time)
** Invoke db:abort_if_pending_migrations (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:abort_if_pending_migrations
** Execute db:test:prepare
** Invoke db:test:load (first_time)
** Invoke db:test:purge (first_time)
** Invoke environment 
** Execute db:test:purge
** Execute db:test:load
** Invoke db:schema:load (first_time)
** Invoke environment 
** Execute db:schema:load
** Execute test:prepare
** Execute test:integration
Loaded suite /home/rubys/.rvm/gems/ruby-1.9.2-p180@global/gems/rake-0.9.2/lib/rake/rake_test_loader
Started
 
 
Finished in 0.190617967 seconds.
 
1 tests, 0 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
0% passed
 
5.25 tests/s, 0.00 assertions/s

Environment

Sat, 16 Jul 2011 12:36:38 GMT
echo $PATH
/home/rubys/.rvm/gems/ruby-1.9.2-p180/bin:/home/rubys/.rvm/gems/ruby-1.9.2-p180@global/bin:/home/rubys/.rvm/rubies/ruby-1.9.2-p180/bin:/home/rubys/.rvm/bin:/home/rubys/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
node -v
v0.2.6
/home/rubys/.rvm/rubies/ruby-1.9.2-p180/bin/ruby -v
ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-linux]
gem -v
1.8.5
bundle show
Gems included by the bundle:
  * actionmailer (3.1.0.rc4)
  * actionpack (3.1.0.rc4)
  * activemerchant (1.15.0)
  * activemodel (3.1.0.rc4)
  * activerecord (3.1.0.rc4)
  * activeresource (3.1.0.rc4)
  * activesupport (3.1.0.rc4)
  * ansi (1.3.0)
  * arel (2.1.3)
  * bcrypt-ruby (2.1.4)
  * braintree (2.10.1)
  * builder (3.0.0)
  * bundler (1.0.15)
  * capistrano (2.6.0)
  * coffee-rails (3.1.0.rc.5)
  * coffee-script (2.2.0)
  * coffee-script-source (1.1.1)
  * erubis (2.7.0)
  * execjs (1.2.0)
  * haml (3.1.2)
  * highline (1.6.2)
  * hike (1.1.0)
  * htmlentities (4.3.0)
  * i18n (0.6.0)
  * jquery-rails (1.0.12)
  * mail (2.3.0)
  * mime-types (1.16)
  * multi_json (1.0.3)
  * mysql (2.8.1)
  * net-scp (1.0.4)
  * net-sftp (2.0.5)
  * net-ssh (2.1.4)
  * net-ssh-gateway (1.1.0)
  * polyglot (0.3.1)
  * rack (1.3.1)
  * rack-cache (1.0.2)
  * rack-mount (0.8.1)
  * rack-ssl (1.3.2)
  * rack-test (0.6.0)
  * rails (3.1.0.rc4 5e2c1d2)
  * railties (3.1.0.rc4)
  * rake (0.9.2)
  * rdoc (3.8)
  * sass (3.1.4)
  * sass-rails (3.1.0.rc.4)
  * sprockets (2.0.0.beta.10)
  * sqlite3 (1.3.3)
  * test-unit (2.3.0)
  * thor (0.14.6)
  * tilt (1.3.2)
  * treetop (1.4.9)
  * turn (0.8.2)
  * tzinfo (0.3.29)
  * uglifier (1.0.0)
rake about
About your application's environment
Ruby version              1.9.2 (x86_64-linux)
RubyGems version          1.8.5
Rack version              1.3
Rails version             3.1.0.rc4
JavaScript Runtime        Node.js (V8)
Active Record version     3.1.0.rc4
Action Pack version       3.1.0.rc4
Active Resource version   3.1.0.rc4
Action Mailer version     3.1.0.rc4
Active Support version    3.1.0.rc4
Application root          /var/www/rtest/work-192/depot
Environment               development
git log -1
commit 5e2c1d2c3a1f8bf29ffb4b641acc1afd13da56f7
Merge: 68e2b8a 357e7bb
Author: Aaron Patterson <aaron.patterson@gmail.com>
Date:   Sat Jul 16 00:31:35 2011 -0700

    Merge pull request #2099 from htanata/backport_2090_to_3-1-stable
    
    Backport #2090 to 3-1-stable