Permalink
Browse files

fixing controller_name to work with subgroup describe blocks

[#732 state:resolved milestone:'Next Release']
  • Loading branch information...
1 parent 5f38b3b commit 25e7b0b77472eacd399fa883ab20c462e33699ea @agibralter agibralter committed with Mar 15, 2009
Showing with 8 additions and 2 deletions.
  1. +8 −2 lib/spec/rails/example/controller_example_group.rb
@@ -69,11 +69,16 @@ def inherited(klass) # :nodoc:
def set_description(*args) # :nodoc:
super
- if described_class && described_class.ancestors.include?(ActionController::Base)
+ @controller_name_defined = true if superclass.controller_name_defined?
+ if described_class && described_class.ancestors.include?(ActionController::Base) && !controller_name_defined?
tests described_class
end
end
-
+
+ def controller_name_defined?
+ @controller_name_defined == true
+ end
+
# When you don't pass a controller to describe, like this:
#
# describe ThingsController do
@@ -85,6 +90,7 @@ def set_description(*args) # :nodoc:
# controller_name :thing
# ...
def controller_name(name)
+ @controller_name_defined = true
tests "#{name}_controller".camelize.constantize
end
end

0 comments on commit 25e7b0b

Please sign in to comment.