Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 6991

Show
Ignore:
Timestamp:
06/10/07 23:06:47 (3 years ago)
Author:
bitsweat
Message:

Get picky about weird Ruby style.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/railties/test/generators/rails_scaffold_generator_test.rb

    r6990 r6991  
    6969    Dir.mkdir("#{RAILS_ROOT}/public") unless File.exists?("#{RAILS_ROOT}/public") 
    7070    Dir.mkdir("#{RAILS_ROOT}/public/stylesheets") unless File.exists?("#{RAILS_ROOT}/public/stylesheets") 
    71     File.open("#{RAILS_ROOT}/config/routes.rb",'w') do |f| 
     71    File.open("#{RAILS_ROOT}/config/routes.rb", 'w') do |f| 
    7272      f<<"ActionController::Routing::Routes.draw do |map|\n\nend\n" 
    7373    end 
     
    9898    assert_generated_controller_for :products do |f| 
    9999 
    100       assert_has_method f,:index do |name,m| 
     100      assert_has_method f, :index do |name, m| 
    101101        assert_match /@products = Product\.find\(:all\)/, m, "#{name} should query products table" 
    102102      end 
    103103 
    104       assert_has_method f,:show,:edit,:update,:destroy  do |name,m| 
     104      assert_has_method f, :show, :edit, :update, :destroy do |name, m| 
    105105        assert_match /@product = Product\.find\(params\[:id\]\)/, m, "#{name.to_s} should query products table" 
    106106      end 
    107107 
    108       assert_has_method f,:new  do |name,m| 
     108      assert_has_method f, :new do |name, m| 
    109109        assert_match /@product = Product\.new/, m, "#{name.to_s} should instantiate a product" 
    110110      end 
    111111 
    112       assert_has_method f,:create  do |name,m| 
     112      assert_has_method f, :create do |name, m| 
    113113        assert_match /@product = Product\.new\(params\[:product\]\)/, m, "#{name.to_s} should instantiate a product" 
    114114        assert_match /format.xml  \{ render :xml => @product.errors, :status => :unprocessable_entity \}/, m, "#{name.to_s} should set status to :unprocessable_entity code for xml" 
     
    123123    assert_generated_helper_for :products 
    124124    assert_generated_stylesheet :scaffold 
    125     assert_generated_views_for :products, "index.html.erb","new.html.erb","edit.html.erb","show.html.erb" 
     125    assert_generated_views_for :products, "index.html.erb", "new.html.erb", "edit.html.erb", "show.html.erb" 
    126126    assert_generated_migration :create_products 
    127127    assert_added_route_for :products 
     
    133133    assert_generated_controller_for :products do |f| 
    134134 
    135       assert_has_method f,:index do |name,m| 
     135      assert_has_method f, :index do |name, m| 
    136136        assert_match /@products = Product\.find\(:all\)/, m, "#{name} should query products table" 
    137137      end 
    138138 
    139       assert_has_method f,:show,:edit,:update,:destroy  do |name,m| 
     139      assert_has_method f, :show, :edit, :update, :destroy do |name, m| 
    140140        assert_match /@product = Product\.find\(params\[:id\]\)/, m, "#{name.to_s} should query products table" 
    141141      end 
    142142 
    143       assert_has_method f,:new  do |name,m| 
     143      assert_has_method f, :new do |name, m| 
    144144        assert_match /@product = Product\.new/, m, "#{name.to_s} should instantiate a product" 
    145145      end 
    146146 
    147       assert_has_method f,:create  do |name,m| 
     147      assert_has_method f, :create do |name, m| 
    148148        assert_match /@product = Product\.new\(params\[:product\]\)/, m, "#{name.to_s} should instantiate a product" 
    149149        assert_match /format.xml  \{ render :xml => @product.errors, :status => :unprocessable_entity \}/, m, "#{name.to_s} should set status to :unprocessable_entity code for xml" 
     
    158158    assert_generated_helper_for :products 
    159159    assert_generated_stylesheet :scaffold 
    160     assert_generated_views_for :products, "index.html.erb","new.html.erb","edit.html.erb","show.html.erb" 
     160    assert_generated_views_for :products, "index.html.erb", "new.html.erb", "edit.html.erb", "show.html.erb" 
    161161    assert_generated_migration :create_products do |t| 
    162162      assert_generated_column t, :name, :string 
    163163      assert_generated_column t, :supplier_id, :integer 
    164       assert_generated_column t, :created_at,:timestamp 
     164      assert_generated_column t, :created_at, :timestamp 
    165165    end 
    166166