mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Fixed teardown method typo (plus whitespace)
This commit is contained in:
parent
68289693f7
commit
15b2175426
1 changed files with 15 additions and 17 deletions
|
@ -28,18 +28,16 @@ module Backoffice
|
|||
end
|
||||
|
||||
class ResourcesTest < Test::Unit::TestCase
|
||||
|
||||
|
||||
# The assertions in these tests are incompatible with the hash method
|
||||
# optimisation. This could indicate user level problems
|
||||
def setup
|
||||
ActionController::Base.optimise_named_routes = false
|
||||
end
|
||||
|
||||
def tear_down
|
||||
|
||||
def teardown
|
||||
ActionController::Base.optimise_named_routes = true
|
||||
end
|
||||
|
||||
|
||||
def test_should_arrange_actions
|
||||
resource = ActionController::Resources::Resource.new(:messages,
|
||||
:collection => { :rss => :get, :reorder => :post, :csv => :post },
|
||||
|
@ -159,14 +157,14 @@ class ResourcesTest < Test::Unit::TestCase
|
|||
|
||||
def test_with_collection_actions_and_name_prefix
|
||||
actions = { 'a' => :get, 'b' => :put, 'c' => :post, 'd' => :delete }
|
||||
|
||||
|
||||
with_restful_routing :messages, :path_prefix => '/threads/:thread_id', :name_prefix => "thread_", :collection => actions do
|
||||
assert_restful_routes_for :messages, :path_prefix => 'threads/1/', :name_prefix => 'thread_', :options => { :thread_id => '1' } do |options|
|
||||
actions.each do |action, method|
|
||||
assert_recognizes(options.merge(:action => action), :path => "/threads/1/messages/#{action}", :method => method)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
assert_restful_named_routes_for :messages, :path_prefix => 'threads/1/', :name_prefix => 'thread_', :options => { :thread_id => '1' } do |options|
|
||||
actions.keys.each do |action|
|
||||
assert_named_route "/threads/1/messages/#{action}", "#{action}_thread_messages_path", :action => action
|
||||
|
@ -177,14 +175,14 @@ class ResourcesTest < Test::Unit::TestCase
|
|||
|
||||
def test_with_collection_action_and_name_prefix_and_formatted
|
||||
actions = { 'a' => :get, 'b' => :put, 'c' => :post, 'd' => :delete }
|
||||
|
||||
|
||||
with_restful_routing :messages, :path_prefix => '/threads/:thread_id', :name_prefix => "thread_", :collection => actions do
|
||||
assert_restful_routes_for :messages, :path_prefix => 'threads/1/', :name_prefix => 'thread_', :options => { :thread_id => '1' } do |options|
|
||||
actions.each do |action, method|
|
||||
assert_recognizes(options.merge(:action => action, :format => 'xml'), :path => "/threads/1/messages/#{action}.xml", :method => method)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
assert_restful_named_routes_for :messages, :path_prefix => 'threads/1/', :name_prefix => 'thread_', :options => { :thread_id => '1' } do |options|
|
||||
actions.keys.each do |action|
|
||||
assert_named_route "/threads/1/messages/#{action}.xml", "formatted_#{action}_thread_messages_path", :action => action, :format => 'xml'
|
||||
|
@ -279,7 +277,7 @@ class ResourcesTest < Test::Unit::TestCase
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def test_with_new_action_with_name_prefix
|
||||
with_restful_routing :messages, :new => { :preview => :post }, :path_prefix => '/threads/:thread_id', :name_prefix => 'thread_' do
|
||||
preview_options = {:action => 'preview', :thread_id => '1'}
|
||||
|
@ -293,7 +291,7 @@ class ResourcesTest < Test::Unit::TestCase
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def test_with_formatted_new_action_with_name_prefix
|
||||
with_restful_routing :messages, :new => { :preview => :post }, :path_prefix => '/threads/:thread_id', :name_prefix => 'thread_' do
|
||||
preview_options = {:action => 'preview', :thread_id => '1', :format => 'xml'}
|
||||
|
@ -307,7 +305,7 @@ class ResourcesTest < Test::Unit::TestCase
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def test_override_new_method
|
||||
with_restful_routing :messages do
|
||||
assert_restful_routes_for :messages do |options|
|
||||
|
@ -524,9 +522,9 @@ class ResourcesTest < Test::Unit::TestCase
|
|||
map.resources :messages, :collection => {:search => :get}, :new => {:preview => :any}, :name_prefix => 'thread_', :path_prefix => '/threads/:thread_id'
|
||||
map.resource :account, :member => {:login => :get}, :new => {:preview => :any}, :name_prefix => 'admin_', :path_prefix => '/admin'
|
||||
end
|
||||
|
||||
|
||||
action_separator = ActionController::Base.resource_action_separator
|
||||
|
||||
|
||||
assert_simply_restful_for :messages, :name_prefix => 'thread_', :path_prefix => 'threads/1/', :options => { :thread_id => '1' }
|
||||
assert_named_route "/threads/1/messages#{action_separator}search", "search_thread_messages_path", {}
|
||||
assert_named_route "/threads/1/messages/new", "new_thread_message_path", {}
|
||||
|
@ -623,7 +621,7 @@ class ResourcesTest < Test::Unit::TestCase
|
|||
assert_simply_restful_for :products, :controller => "backoffice/products"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def test_nested_resources_using_namespace
|
||||
with_routing do |set|
|
||||
set.draw do |map|
|
||||
|
@ -795,7 +793,7 @@ class ResourcesTest < Test::Unit::TestCase
|
|||
|
||||
yield options[:options] if block_given?
|
||||
end
|
||||
|
||||
|
||||
def assert_singleton_routes_for(singleton_name, options = {})
|
||||
options[:options] ||= {}
|
||||
options[:options][:controller] = options[:controller] || singleton_name.to_s.pluralize
|
||||
|
@ -855,7 +853,7 @@ class ResourcesTest < Test::Unit::TestCase
|
|||
actual = @controller.send(route, options) rescue $!.class.name
|
||||
assert_equal expected, actual, "Error on route: #{route}(#{options.inspect})"
|
||||
end
|
||||
|
||||
|
||||
def assert_resource_methods(expected, resource, action_method, method)
|
||||
assert_equal expected.length, resource.send("#{action_method}_methods")[method].size, "#{resource.send("#{action_method}_methods")[method].inspect}"
|
||||
expected.each do |action|
|
||||
|
|
Loading…
Reference in a new issue