rails 0.12.1 → 0.13.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of rails might be problematic. Click here for more details.

Files changed (46) hide show
  1. data/CHANGELOG +59 -10
  2. data/Rakefile +23 -11
  3. data/bin/console +6 -5
  4. data/bin/console_sandbox +0 -6
  5. data/bin/listener +86 -0
  6. data/bin/profiler +27 -10
  7. data/bin/rails +3 -1
  8. data/bin/runner +24 -0
  9. data/bin/server +1 -0
  10. data/bin/tracker +69 -0
  11. data/configs/database.yml +3 -0
  12. data/dispatches/dispatch.fcgi +22 -25
  13. data/dispatches/gateway.cgi +97 -0
  14. data/environments/development.rb +2 -0
  15. data/environments/environment.rb +1 -0
  16. data/environments/test.rb +2 -0
  17. data/fresh_rakefile +9 -4
  18. data/helpers/test_helper.rb +16 -5
  19. data/html/404.html +2 -0
  20. data/html/500.html +2 -0
  21. data/html/index.html +3 -0
  22. data/html/javascripts/controls.js +261 -0
  23. data/html/javascripts/dragdrop.js +476 -0
  24. data/html/javascripts/effects.js +570 -0
  25. data/html/javascripts/prototype.js +633 -371
  26. data/lib/console_sandbox.rb +6 -0
  27. data/lib/dispatcher.rb +13 -11
  28. data/lib/fcgi_handler.rb +166 -0
  29. data/lib/rails_generator/generators/applications/app/app_generator.rb +16 -12
  30. data/lib/rails_generator/generators/components/mailer/mailer_generator.rb +2 -2
  31. data/lib/rails_generator/generators/components/mailer/templates/unit_test.rb +3 -1
  32. data/lib/rails_generator/generators/components/migration/USAGE +14 -0
  33. data/lib/rails_generator/generators/components/migration/migration_generator.rb +9 -0
  34. data/lib/rails_generator/generators/components/migration/templates/migration.rb +7 -0
  35. data/lib/rails_generator/generators/components/model/model_generator.rb +1 -1
  36. data/lib/rails_generator/generators/components/scaffold/USAGE +1 -1
  37. data/lib/rails_generator/generators/components/scaffold/templates/controller.rb +11 -11
  38. data/lib/rails_generator/generators/components/scaffold/templates/functional_test.rb +38 -20
  39. data/lib/rails_generator/generators/components/scaffold/templates/layout.rhtml +2 -0
  40. data/lib/rails_generator/generators/components/scaffold/templates/style.css +22 -1
  41. data/lib/rails_generator/generators/components/scaffold/templates/view_edit.rhtml +2 -2
  42. data/lib/rails_generator/generators/components/scaffold/templates/view_list.rhtml +5 -5
  43. data/lib/rails_generator/generators/components/scaffold/templates/view_new.rhtml +1 -1
  44. data/lib/rubyprof_ext.rb +35 -0
  45. data/lib/webrick_server.rb +84 -43
  46. metadata +22 -8
@@ -0,0 +1,6 @@
1
+ ActiveRecord::Base.lock_mutex
2
+ ActiveRecord::Base.connection.begin_db_transaction
3
+ at_exit do
4
+ ActiveRecord::Base.connection.rollback_db_transaction
5
+ ActiveRecord::Base.unlock_mutex
6
+ end
@@ -25,17 +25,24 @@ require 'breakpoint'
25
25
 
26
26
  class Dispatcher
27
27
  class << self
28
- def dispatch(cgi = CGI.new, session_options = ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS)
28
+ def dispatch(cgi = CGI.new, session_options = ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS, output = $stdout)
29
29
  begin
30
30
  request, response = ActionController::CgiRequest.new(cgi, session_options), ActionController::CgiResponse.new(cgi)
31
31
  prepare_application
32
- ActionController::Routing::Routes.recognize!(request).process(request, response).out
32
+ ActionController::Routing::Routes.recognize!(request).process(request, response).out(output)
33
33
  rescue Object => exception
34
- ActionController::Base.process_with_exception(request, response, exception).out
34
+ ActionController::Base.process_with_exception(request, response, exception).out(output)
35
35
  ensure
36
- reset_application
36
+ reset_after_dispatch
37
37
  end
38
38
  end
39
+
40
+ def reset_application!
41
+ Controllers.clear!
42
+ Dependencies.clear
43
+ Dependencies.remove_subclasses_for(ActiveRecord::Base, ActiveRecord::Observer, ActionController::Base)
44
+ Dependencies.remove_subclasses_for(ActionMailer::Base) if defined?(ActionMailer::Base)
45
+ end
39
46
 
40
47
  private
41
48
  def prepare_application
@@ -44,13 +51,8 @@ class Dispatcher
44
51
  Controllers.const_load!(:ApplicationController, "application") unless Controllers.const_defined?(:ApplicationController)
45
52
  end
46
53
 
47
- def reset_application
48
- if Dependencies.load?
49
- Controllers.clear!
50
- Dependencies.clear
51
- Dependencies.remove_subclasses_for(ActiveRecord::Base, ActiveRecord::Observer, ActionController::Base)
52
- end
53
-
54
+ def reset_after_dispatch
55
+ reset_application! if Dependencies.load?
54
56
  Breakpoint.deactivate_drb if defined?(BREAKPOINT_SERVER_PORT)
55
57
  end
56
58
  end
@@ -0,0 +1,166 @@
1
+ require 'fcgi'
2
+ require 'logger'
3
+ require 'dispatcher'
4
+
5
+ class RailsFCGIHandler
6
+ SIGNALS = {
7
+ 'HUP' => :reload,
8
+ 'TERM' => :graceful_exit,
9
+ 'USR1' => :graceful_exit
10
+ }
11
+
12
+ attr_reader :when_ready
13
+ attr_reader :processing
14
+
15
+ attr_accessor :log_file_path
16
+ attr_accessor :gc_request_period
17
+
18
+
19
+ # Initialize and run the FastCGI instance, passing arguments through to new.
20
+ def self.process!(*args, &block)
21
+ new(*args, &block).process!
22
+ end
23
+
24
+ # Initialize the FastCGI instance with the path to a crash log
25
+ # detailing unhandled exceptions (default RAILS_ROOT/log/fastcgi.crash.log)
26
+ # and the number of requests to process between garbage collection runs
27
+ # (default nil for normal GC behavior.) Optionally, pass a block which
28
+ # takes this instance as an argument for further configuration.
29
+ def initialize(log_file_path = nil, gc_request_period = nil)
30
+ @when_ready = nil
31
+ @processing = false
32
+
33
+ self.log_file_path = log_file_path || "#{RAILS_ROOT}/log/fastcgi.crash.log"
34
+ self.gc_request_period = gc_request_period
35
+
36
+ # Yield for additional configuration.
37
+ yield self if block_given?
38
+
39
+ # Safely install signal handlers.
40
+ install_signal_handlers
41
+
42
+ # Start error timestamp at 11 seconds ago.
43
+ @last_error_on = Time.now - 11
44
+
45
+ dispatcher_log(:info, "starting")
46
+ end
47
+
48
+ def process!(provider = FCGI)
49
+ # Make a note of $" so we can safely reload this instance.
50
+ mark!
51
+
52
+ # Begin countdown to garbage collection.
53
+ run_gc! if gc_request_period
54
+
55
+ provider.each_cgi do |cgi|
56
+ # Safely reload this instance if requested.
57
+ if when_ready == :reload
58
+ run_gc! if gc_request_period
59
+ restore!
60
+ @when_ready = nil
61
+ dispatcher_log(:info, "reloaded")
62
+ end
63
+
64
+ process_request(cgi)
65
+
66
+ # Break if graceful exit requested.
67
+ break if when_ready == :exit
68
+
69
+ # Garbage collection countdown.
70
+ if gc_request_period
71
+ @gc_request_countdown -= 1
72
+ run_gc! if @gc_request_countdown <= 0
73
+ end
74
+ end
75
+
76
+ GC.enable
77
+ dispatcher_log(:info, "terminated gracefully")
78
+
79
+ rescue SystemExit => exit_error
80
+ dispatcher_log(:info, "terminated by explicit exit")
81
+
82
+ rescue Object => fcgi_error
83
+ # retry on errors that would otherwise have terminated the FCGI process,
84
+ # but only if they occur more than 10 seconds apart.
85
+ if !(SignalException === fcgi_error) && Time.now - @last_error_on > 10
86
+ @last_error_on = Time.now
87
+ dispatcher_error(fcgi_error, "almost killed by this error")
88
+ retry
89
+ else
90
+ dispatcher_error(fcgi_error, "killed by this error")
91
+ end
92
+ end
93
+
94
+
95
+ private
96
+ def logger
97
+ @logger ||= Logger.new(@log_file_path)
98
+ end
99
+
100
+ def dispatcher_log(level, msg)
101
+ time_str = Time.now.strftime("%d/%b/%Y:%H:%M:%S")
102
+ logger.send(level, "[#{time_str} :: #{$$}] #{msg}")
103
+ rescue Object => log_error
104
+ STDERR << "Couldn't write to #{@log_file_path.inspect}: #{msg}\n"
105
+ STDERR << " #{log_error.class}: #{log_error.message}\n"
106
+ end
107
+
108
+ def dispatcher_error(e,msg="")
109
+ error_message =
110
+ "Dispatcher failed to catch: #{e} (#{e.class})\n" +
111
+ " #{e.backtrace.join("\n ")}\n#{msg}"
112
+ dispatcher_log(:error, error_message)
113
+ end
114
+
115
+ def install_signal_handlers
116
+ SIGNALS.each do |signal, handler_name|
117
+ install_signal_handler signal, method("#{handler_name}_handler").to_proc
118
+ end
119
+ end
120
+
121
+ def install_signal_handler(signal, handler)
122
+ trap signal, handler
123
+ rescue ArgumentError
124
+ dispatcher_log :warn, "Ignoring unsupported signal #{signal}."
125
+ end
126
+
127
+ def graceful_exit_handler(signal)
128
+ if processing
129
+ dispatcher_log :info, "asked to terminate ASAP"
130
+ @when_ready = :exit
131
+ else
132
+ dispatcher_log :info, "told to terminate NOW"
133
+ exit
134
+ end
135
+ end
136
+
137
+ def reload_handler(signal)
138
+ @when_ready = :reload
139
+ dispatcher_log :info, "asked to reload ASAP"
140
+ end
141
+
142
+ def process_request(cgi)
143
+ @processing = true
144
+ Dispatcher.dispatch(cgi)
145
+ rescue Object => e
146
+ raise if SignalException === e
147
+ dispatcher_error(e)
148
+ ensure
149
+ @processing = false
150
+ end
151
+
152
+ def mark!
153
+ @features = $".clone
154
+ end
155
+
156
+ def restore!
157
+ $".replace @features
158
+ Dispatcher.reset_application!
159
+ ActionController::Routing::Routes.reload
160
+ end
161
+
162
+ def run_gc!
163
+ @gc_request_countdown = gc_request_period
164
+ GC.enable; GC.start; GC.disable
165
+ end
166
+ end
@@ -23,27 +23,27 @@ class AppGenerator < Rails::Generator::Base
23
23
 
24
24
  # Root
25
25
  m.file "fresh_rakefile", "Rakefile"
26
- m.file "README", "README"
27
- m.file "CHANGELOG", "CHANGELOG"
26
+ m.file "README", "README"
27
+ m.file "CHANGELOG", "CHANGELOG"
28
28
 
29
29
  # Application
30
- m.template "helpers/application.rb", "app/controllers/application.rb"
30
+ m.template "helpers/application.rb", "app/controllers/application.rb"
31
31
  m.template "helpers/application_helper.rb", "app/helpers/application_helper.rb"
32
- m.template "helpers/test_helper.rb", "test/test_helper.rb"
32
+ m.template "helpers/test_helper.rb", "test/test_helper.rb"
33
33
 
34
34
  # database.yml and .htaccess
35
35
  m.template "configs/database.yml", "config/database.yml"
36
- m.template "configs/routes.rb", "config/routes.rb"
37
- m.template "configs/apache.conf", "public/.htaccess"
36
+ m.template "configs/routes.rb", "config/routes.rb"
37
+ m.template "configs/apache.conf", "public/.htaccess"
38
38
 
39
39
  # Environments
40
40
  m.file "environments/environment.rb", "config/environment.rb"
41
- m.file "environments/production.rb", "config/environments/production.rb"
41
+ m.file "environments/production.rb", "config/environments/production.rb"
42
42
  m.file "environments/development.rb", "config/environments/development.rb"
43
- m.file "environments/test.rb", "config/environments/test.rb"
43
+ m.file "environments/test.rb", "config/environments/test.rb"
44
44
 
45
- # Scripts
46
- %w(console console_sandbox destroy generate server runner benchmarker profiler).each do |file|
45
+ # Scripts (tracker listener)
46
+ %w(console destroy generate server runner benchmarker profiler ).each do |file|
47
47
  m.file "bin/#{file}", "script/#{file}", script_options
48
48
  end
49
49
  if options[:gem]
@@ -53,9 +53,10 @@ class AppGenerator < Rails::Generator::Base
53
53
  end
54
54
 
55
55
  # Dispatches
56
- m.file "dispatches/dispatch.rb", "public/dispatch.rb", script_options
57
- m.file "dispatches/dispatch.rb", "public/dispatch.cgi", script_options
56
+ m.file "dispatches/dispatch.rb", "public/dispatch.rb", script_options
57
+ m.file "dispatches/dispatch.rb", "public/dispatch.cgi", script_options
58
58
  m.file "dispatches/dispatch.fcgi", "public/dispatch.fcgi", script_options
59
+ # m.file "dispatches/gateway.cgi", "public/gateway.cgi", script_options
59
60
 
60
61
  # HTML files
61
62
  %w(404 500 index).each do |file|
@@ -66,6 +67,9 @@ class AppGenerator < Rails::Generator::Base
66
67
 
67
68
  # Javascripts
68
69
  m.file "html/javascripts/prototype.js", "public/javascripts/prototype.js"
70
+ m.file "html/javascripts/effects.js", "public/javascripts/effects.js"
71
+ m.file "html/javascripts/dragdrop.js", "public/javascripts/dragdrop.js"
72
+ m.file "html/javascripts/controls.js", "public/javascripts/controls.js"
69
73
 
70
74
  # Docs
71
75
  m.file "doc/README_FOR_APP", "doc/README_FOR_APP"
@@ -8,7 +8,7 @@ class MailerGenerator < Rails::Generator::NamedBase
8
8
  m.directory File.join('app/models', class_path)
9
9
  m.directory File.join('app/views', class_path, file_name)
10
10
  m.directory File.join('test/unit', class_path)
11
- m.directory File.join('test/fixtures', class_path, table_name)
11
+ m.directory File.join('test/fixtures', class_path, file_name)
12
12
 
13
13
  # Mailer class and unit test.
14
14
  m.template "mailer.rb", File.join('app/models',
@@ -24,7 +24,7 @@ class MailerGenerator < Rails::Generator::NamedBase
24
24
  File.join('app/views', class_path, file_name, "#{action}.rhtml"),
25
25
  :assigns => { :action => action }
26
26
  m.template "fixture.rhtml",
27
- File.join('test/fixtures', class_path, table_name, action),
27
+ File.join('test/fixtures', class_path, file_name, action),
28
28
  :assigns => { :action => action }
29
29
  end
30
30
  end
@@ -5,6 +5,8 @@ class <%= class_name %>Test < Test::Unit::TestCase
5
5
  FIXTURES_PATH = File.dirname(__FILE__) + '/../fixtures'
6
6
  CHARSET = "utf-8"
7
7
 
8
+ include ActionMailer::Quoting
9
+
8
10
  def setup
9
11
  ActionMailer::Base.delivery_method = :test
10
12
  ActionMailer::Base.perform_deliveries = true
@@ -30,6 +32,6 @@ class <%= class_name %>Test < Test::Unit::TestCase
30
32
  end
31
33
 
32
34
  def encode(subject)
33
- ActionMailer::Base.quoted_printable(subject, CHARSET)
35
+ quoted_printable(subject, CHARSET)
34
36
  end
35
37
  end
@@ -0,0 +1,14 @@
1
+ Description:
2
+ The migration generator creates a stub for a new database migration.
3
+
4
+ The generator takes a migration name as its argument. The migration name may be
5
+ given in CamelCase or under_score.
6
+
7
+ The generator creates a migration class in db/migrate prefixed by its number
8
+ in the queue.
9
+
10
+ Example:
11
+ ./script/generate migration AddSslFlag
12
+
13
+ With 4 existing migrations, this will create an AddSslFlag migration in the
14
+ file db/migrate/5_add_ssl_flag.rb
@@ -0,0 +1,9 @@
1
+ class MigrationGenerator < Rails::Generator::NamedBase
2
+ def manifest
3
+ record do |m|
4
+ m.directory File.join('db/migrate')
5
+ next_migration_number = Dir.glob("db/migrate/[0-9]*.*").size + 1
6
+ m.template 'migration.rb', File.join('db/migrate', "#{next_migration_number}_#{file_name}.rb")
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,7 @@
1
+ class <%= class_name %> < ActiveRecord::Migration
2
+ def self.up
3
+ end
4
+
5
+ def self.down
6
+ end
7
+ end
@@ -12,7 +12,7 @@ class ModelGenerator < Rails::Generator::NamedBase
12
12
  # Model class, unit test, and fixtures.
13
13
  m.template 'model.rb', File.join('app/models', class_path, "#{file_name}.rb")
14
14
  m.template 'unit_test.rb', File.join('test/unit', class_path, "#{file_name}_test.rb")
15
- m.template 'fixtures.yml', File.join('test/fixtures', class_path, "#{table_name}.yml")
15
+ m.template 'fixtures.yml', File.join('test/fixtures', class_path, "#{ActiveRecord::Base.pluralize_table_names ? plural_name : singular_name}.yml")
16
16
  end
17
17
  end
18
18
  end
@@ -25,7 +25,7 @@ Example:
25
25
  database and browse to http://localhost/bank/ -- voila, you're on Rails!
26
26
 
27
27
  Modules Example:
28
- ./script/generate controller 'admin/credit_card' suspend late_fee
28
+ ./script/generate scaffold CreditCard 'admin/credit_card' suspend late_fee
29
29
 
30
30
  This will generate a CreditCard model and CreditCardController controller
31
31
  in the admin module.
@@ -2,7 +2,7 @@ class <%= controller_class_name %>Controller < ApplicationController
2
2
  <% unless suffix -%>
3
3
  def index
4
4
  list
5
- render_action 'list'
5
+ render :action => 'list'
6
6
  end
7
7
  <% end -%>
8
8
 
@@ -16,7 +16,7 @@ class <%= controller_class_name %>Controller < ApplicationController
16
16
  end
17
17
 
18
18
  def show<%= suffix %>
19
- @<%= singular_name %> = <%= model_name %>.find(@params[:id])
19
+ @<%= singular_name %> = <%= model_name %>.find(params[:id])
20
20
  end
21
21
 
22
22
  def new<%= suffix %>
@@ -24,31 +24,31 @@ class <%= controller_class_name %>Controller < ApplicationController
24
24
  end
25
25
 
26
26
  def create<%= suffix %>
27
- @<%= singular_name %> = <%= model_name %>.new(@params[:<%= singular_name %>])
27
+ @<%= singular_name %> = <%= model_name %>.new(params[:<%= singular_name %>])
28
28
  if @<%= singular_name %>.save
29
- flash['notice'] = '<%= model_name %> was successfully created.'
29
+ flash[:notice] = '<%= model_name %> was successfully created.'
30
30
  redirect_to :action => 'list<%= suffix %>'
31
31
  else
32
- render_action 'new<%= suffix %>'
32
+ render :action => 'new<%= suffix %>'
33
33
  end
34
34
  end
35
35
 
36
36
  def edit<%= suffix %>
37
- @<%= singular_name %> = <%= model_name %>.find(@params[:id])
37
+ @<%= singular_name %> = <%= model_name %>.find(params[:id])
38
38
  end
39
39
 
40
40
  def update
41
- @<%= singular_name %> = <%= model_name %>.find(@params[:id])
42
- if @<%= singular_name %>.update_attributes(@params[:<%= singular_name %>])
43
- flash['notice'] = '<%= model_name %> was successfully updated.'
41
+ @<%= singular_name %> = <%= model_name %>.find(params[:id])
42
+ if @<%= singular_name %>.update_attributes(params[:<%= singular_name %>])
43
+ flash[:notice] = '<%= model_name %> was successfully updated.'
44
44
  redirect_to :action => 'show<%= suffix %>', :id => @<%= singular_name %>
45
45
  else
46
- render_action 'edit<%= suffix %>'
46
+ render :action => 'edit<%= suffix %>'
47
47
  end
48
48
  end
49
49
 
50
50
  def destroy<%= suffix %>
51
- <%= model_name %>.find(@params[:id]).destroy
51
+ <%= model_name %>.find(params[:id]).destroy
52
52
  redirect_to :action => 'list<%= suffix %>'
53
53
  end
54
54
  end
@@ -16,65 +16,83 @@ class <%= controller_class_name %>ControllerTest < Test::Unit::TestCase
16
16
  <% for action in unscaffolded_actions -%>
17
17
  def test_<%= action %>
18
18
  get :<%= action %>
19
- assert_rendered_file '<%= action %>'
19
+ assert_response :success
20
+ assert_template '<%= action %>'
20
21
  end
21
22
 
22
23
  <% end -%>
23
24
  <% unless suffix -%>
24
25
  def test_index
25
26
  get :index
26
- assert_rendered_file 'list'
27
+ assert_response :success
28
+ assert_template 'list'
27
29
  end
28
30
 
29
31
  <% end -%>
30
32
  def test_list<%= suffix %>
31
33
  get :list<%= suffix %>
32
- assert_rendered_file 'list<%= suffix %>'
33
- assert_template_has '<%= plural_name %>'
34
+
35
+ assert_response :success
36
+ assert_template 'list<%= suffix %>'
37
+
38
+ assert_not_nil assigns(:<%= plural_name %>)
34
39
  end
35
40
 
36
41
  def test_show<%= suffix %>
37
- get :show<%= suffix %>, 'id' => 1
38
- assert_rendered_file 'show'
39
- assert_template_has '<%= singular_name %>'
40
- assert_valid_record '<%= singular_name %>'
42
+ get :show<%= suffix %>, :id => 1
43
+
44
+ assert_response :success
45
+ assert_template 'show'
46
+
47
+ assert_not_nil assigns(:<%= singular_name %>)
48
+ assert assigns(:<%= singular_name %>).valid?
41
49
  end
42
50
 
43
51
  def test_new<%= suffix %>
44
52
  get :new<%= suffix %>
45
- assert_rendered_file 'new<%= suffix %>'
46
- assert_template_has '<%= singular_name %>'
53
+
54
+ assert_response :success
55
+ assert_template 'new<%= suffix %>'
56
+
57
+ assert_not_nil assigns(:<%= singular_name %>)
47
58
  end
48
59
 
49
60
  def test_create
50
- num_<%= plural_name %> = <%= model_name %>.find_all.size
61
+ num_<%= plural_name %> = <%= model_name %>.count
62
+
63
+ post :create<%= suffix %>, :<%= singular_name %> => {}
51
64
 
52
- post :create<%= suffix %>, '<%= singular_name %>' => { }
65
+ assert_response :redirect
53
66
  assert_redirected_to :action => 'list<%= suffix %>'
54
67
 
55
- assert_equal num_<%= plural_name %> + 1, <%= model_name %>.find_all.size
68
+ assert_equal num_<%= plural_name %> + 1, <%= model_name %>.count
56
69
  end
57
70
 
58
71
  def test_edit<%= suffix %>
59
- get :edit<%= suffix %>, 'id' => 1
60
- assert_rendered_file 'edit<%= suffix %>'
61
- assert_template_has '<%= singular_name %>'
62
- assert_valid_record '<%= singular_name %>'
72
+ get :edit<%= suffix %>, :id => 1
73
+
74
+ assert_response :success
75
+ assert_template 'edit<%= suffix %>'
76
+
77
+ assert_not_nil assigns(:<%= singular_name %>)
78
+ assert assigns(:<%= singular_name %>).valid?
63
79
  end
64
80
 
65
81
  def test_update<%= suffix %>
66
- post :update<%= suffix %>, 'id' => 1
82
+ post :update<%= suffix %>, :id => 1
83
+ assert_response :redirect
67
84
  assert_redirected_to :action => 'show<%= suffix %>', :id => 1
68
85
  end
69
86
 
70
87
  def test_destroy<%= suffix %>
71
88
  assert_not_nil <%= model_name %>.find(1)
72
89
 
73
- post :destroy, 'id' => 1
90
+ post :destroy, :id => 1
91
+ assert_response :redirect
74
92
  assert_redirected_to :action => 'list<%= suffix %>'
75
93
 
76
94
  assert_raise(ActiveRecord::RecordNotFound) {
77
- <%= singular_name %> = <%= model_name %>.find(1)
95
+ <%= model_name %>.find(1)
78
96
  }
79
97
  end
80
98
  end