This patch roughly solves the problem of 2.0/edge/1.2.3+ routing for nested and namespaced (these are broken too) resources...
Index: vendor/plugins/shoulda/lib/shoulda/controller_tests/controller_tests.rb
===================================================================
--- vendor/plugins/shoulda/lib/shoulda/controller_tests/controller_tests.rb (revision 319)
+++ vendor/plugins/shoulda/lib/shoulda/controller_tests/controller_tests.rb (working copy)
@@ -239,17 +239,24 @@
ensure_valid_members(@formats, VALID_FORMATS, 'formats')
@identifier ||= :id
- @klass ||= target.name.gsub(/ControllerTest$/, '').singularize.constantize
+ @namespace ||= target.name.split('::').slice(0..-2).map(&:underscore).map(&:to_sym)
+ @klass ||= target.name.split('::').last.gsub(/ControllerTest$/, '').singularize.constantize
@object ||= @klass.name.tableize.singularize
@parent ||= []
@parent = [@parent] unless @parent.is_a? Array
singular_args = @parent.map
{|n| "@#{object}.#{n}"}
- @destroy.redirect ||= "#{@object.pluralize}_url(#{singular_args.join(', ')})"
+
+ namespace_pieces = [@namespace, @parent].flatten
+ @namespace_prefix = ''
+ @namespace_prefix << namespace_pieces.join('_')
+ @namespace_prefix << '_' unless @namespace_prefix.blank?
+
+ @destroy.redirect ||= "#{@
namespace_prefix}#{@object.pluralize}_url(#{singular_args.join(', ')})"
singular_args << "@#{object}"
- @create.redirect ||= "#{@object}_url(#{singular_args.join(', ')})"
- @update.redirect ||= "#{@object}_url(#{singular_args.join(', ')})"
+ @
create.redirect ||= "#{@namespace_prefix}#{@object}_url(#{singular_args.join(', ')})"
+ @update.redirect ||= "#{@namespace_prefix}#{@object}_url(#{singular_args.join(', ')})"
@denied.redirect ||= "new_session_url"
end