Skip to content
Browse files

Fixed that generate scaffold would produce bad functional tests

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@474 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent bbd3e39 commit 38ee39a4a5e719694dca553ef739dbf99645c2b2 @dhh dhh committed Jan 22, 2005
View
7 railties/CHANGELOG
@@ -1,3 +1,10 @@
+*SVN*
+
+* Fixed that generate scaffold would produce bad functional tests
+
+* Fixed that FCGI can also display SyntaxErrors
+
+
*0.9.4.1* (January 18th, 2005)
* Added 5-second timeout to WordNet alternatives on creating reserved-word models #501 [Marcel Molina]
View
16 railties/generators/scaffold/scaffold_generator.rb
@@ -9,30 +9,30 @@ def generate
template "fixtures.yml", "test/fixtures/#{table_name}.yml"
@controller_class_name = args.empty? ? Inflector.pluralize(class_name) : args.shift.sub(/^[a-z]?/) { |m| m.capitalize }
- controller_name = Inflector.underscore(@controller_class_name)
+ @controller_name = Inflector.underscore(@controller_class_name)
# Controller class, functional test, helper, and views.
- template "controller.rb", "app/controllers/#{controller_name}_controller.rb"
- template "functional_test.rb", "test/functional/#{controller_name}_controller_test.rb"
- template "controller/helper.rb", "app/helpers/#{controller_name}_helper.rb"
+ template "controller.rb", "app/controllers/#{@controller_name}_controller.rb"
+ template "functional_test.rb", "test/functional/#{@controller_name}_controller_test.rb"
+ template "controller/helper.rb", "app/helpers/#{@controller_name}_helper.rb"
# Layout and stylesheet.
- unless File.file?("app/views/layouts/#{controller_name}.rhtml")
- template "layout.rhtml", "app/views/layouts/#{controller_name}.rhtml"
+ unless File.file?("app/views/layouts/#{@controller_name}.rhtml")
+ template "layout.rhtml", "app/views/layouts/#{@controller_name}.rhtml"
end
unless File.file?("public/stylesheets/scaffold.css")
template "style.css", "public/stylesheets/scaffold.css"
end
# Scaffolded views.
scaffold_views.each do |action|
- template "view_#{action}.rhtml", "app/views/#{controller_name}/#{action}.rhtml"
+ template "view_#{action}.rhtml", "app/views/#{@controller_name}/#{action}.rhtml"
end
# Unscaffolded views.
unscaffolded_actions.each do |action|
template "controller/view.rhtml",
- "app/views/#{controller_name}/#{action}.rhtml",
+ "app/views/#{@controller_name}/#{action}.rhtml",
binding
end
end
View
8 railties/generators/scaffold/templates/functional_test.rb
@@ -1,14 +1,14 @@
require File.dirname(__FILE__) + '/../test_helper'
-require '<%= file_name %>_controller'
+require '<%= @controller_name %>_controller'
# Re-raise errors caught by the controller.
-class <%= class_name %>Controller; def rescue_action(e) raise e end; end
+class <%= @controller_class_name %>Controller; def rescue_action(e) raise e end; end
-class <%= class_name %>ControllerTest < Test::Unit::TestCase
+class <%= @controller_class_name %>ControllerTest < Test::Unit::TestCase
fixtures :<%= table_name %>
def setup
- @controller = <%= class_name %>Controller.new
+ @controller = <%= @controller_class_name %>Controller.new
@request, @response = ActionController::TestRequest.new, ActionController::TestResponse.new
end

0 comments on commit 38ee39a

Please sign in to comment.
Something went wrong with that request. Please try again.