Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Define name before subclassing in anonymous controller spec

- this is necessary because Rails 3.1 relies on name in an inherited
  hook.
  • Loading branch information...
commit 9ebf963d742291f4ec8ccdaaa230c89edbdba983 1 parent 877ac18
David Chelimsky dchelimsky authored
Showing with 3 additions and 5 deletions.
  1. +3 −5 lib/rspec/rails/example/controller_example_group.rb
8 lib/rspec/rails/example/controller_example_group.rb
View
@@ -125,11 +125,9 @@ def controller_class
# defined in +ApplicationController+, however, are accessible from within
# the block.
def controller(base_class = ApplicationController, &body)
- metadata[:example_group][:describes] = Class.new(base_class, &body)
- metadata[:example_group][:describes].singleton_class.class_eval do
- def name
- "StubResourcesController"
- end
+ base_class.dup.tap do |new_base|
+ def new_base.name; "StubResourcesController"; end
+ metadata[:example_group][:describes] = Class.new(new_base, &body)
end
before do
Please sign in to comment.
Something went wrong with that request. Please try again.