Skip to content

Commit

Permalink
Get picky about weird Ruby style.
Browse files Browse the repository at this point in the history
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6991 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information
jeremy committed Jun 10, 2007
1 parent 5179b35 commit 4e23e65
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions railties/test/generators/rails_scaffold_generator_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def setup
Dir.mkdir("#{RAILS_ROOT}/test/fixtures") unless File.exists?("#{RAILS_ROOT}/test/fixtures")
Dir.mkdir("#{RAILS_ROOT}/public") unless File.exists?("#{RAILS_ROOT}/public")
Dir.mkdir("#{RAILS_ROOT}/public/stylesheets") unless File.exists?("#{RAILS_ROOT}/public/stylesheets")
File.open("#{RAILS_ROOT}/config/routes.rb",'w') do |f|
File.open("#{RAILS_ROOT}/config/routes.rb", 'w') do |f|
f<<"ActionController::Routing::Routes.draw do |map|\n\nend\n"
end
end
Expand Down Expand Up @@ -97,19 +97,19 @@ def test_scaffold_generates_resources
assert_generated_controller_for :products do |f|
assert_has_method f,:index do |name,m|
assert_has_method f, :index do |name, m|
assert_match /@products = Product\.find\(:all\)/, m, "#{name} should query products table"
end
assert_has_method f,:show,:edit,:update,:destroy do |name,m|
assert_has_method f, :show, :edit, :update, :destroy do |name, m|
assert_match /@product = Product\.find\(params\[:id\]\)/, m, "#{name.to_s} should query products table"
end
assert_has_method f,:new do |name,m|
assert_has_method f, :new do |name, m|
assert_match /@product = Product\.new/, m, "#{name.to_s} should instantiate a product"
end
assert_has_method f,:create do |name,m|
assert_has_method f, :create do |name, m|
assert_match /@product = Product\.new\(params\[:product\]\)/, m, "#{name.to_s} should instantiate a product"
assert_match /format.xml \{ render :xml => @product.errors, :status => :unprocessable_entity \}/, m, "#{name.to_s} should set status to :unprocessable_entity code for xml"
end
Expand All @@ -122,7 +122,7 @@ def test_scaffold_generates_resources
assert_generated_fixtures_for :products
assert_generated_helper_for :products
assert_generated_stylesheet :scaffold
assert_generated_views_for :products, "index.html.erb","new.html.erb","edit.html.erb","show.html.erb"
assert_generated_views_for :products, "index.html.erb", "new.html.erb", "edit.html.erb", "show.html.erb"
assert_generated_migration :create_products
assert_added_route_for :products
end
Expand All @@ -132,19 +132,19 @@ def test_scaffold_generates_resources_with_attributes
assert_generated_controller_for :products do |f|
assert_has_method f,:index do |name,m|
assert_has_method f, :index do |name, m|
assert_match /@products = Product\.find\(:all\)/, m, "#{name} should query products table"
end
assert_has_method f,:show,:edit,:update,:destroy do |name,m|
assert_has_method f, :show, :edit, :update, :destroy do |name, m|
assert_match /@product = Product\.find\(params\[:id\]\)/, m, "#{name.to_s} should query products table"
end
assert_has_method f,:new do |name,m|
assert_has_method f, :new do |name, m|
assert_match /@product = Product\.new/, m, "#{name.to_s} should instantiate a product"
end
assert_has_method f,:create do |name,m|
assert_has_method f, :create do |name, m|
assert_match /@product = Product\.new\(params\[:product\]\)/, m, "#{name.to_s} should instantiate a product"
assert_match /format.xml \{ render :xml => @product.errors, :status => :unprocessable_entity \}/, m, "#{name.to_s} should set status to :unprocessable_entity code for xml"
end
Expand All @@ -157,11 +157,11 @@ def test_scaffold_generates_resources_with_attributes
assert_generated_fixtures_for :products
assert_generated_helper_for :products
assert_generated_stylesheet :scaffold
assert_generated_views_for :products, "index.html.erb","new.html.erb","edit.html.erb","show.html.erb"
assert_generated_views_for :products, "index.html.erb", "new.html.erb", "edit.html.erb", "show.html.erb"
assert_generated_migration :create_products do |t|
assert_generated_column t, :name, :string
assert_generated_column t, :supplier_id, :integer
assert_generated_column t, :created_at,:timestamp
assert_generated_column t, :created_at, :timestamp
end
assert_added_route_for :products
Expand Down

0 comments on commit 4e23e65

Please sign in to comment.