Skip to content

Commit

Permalink
Fix render_views for anonymous controllers on 1.8.7. Closes rspec#525
Browse files Browse the repository at this point in the history
  • Loading branch information
justinko committed Apr 18, 2012
1 parent 3562f8f commit 10bba44
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions Changelog.md
Expand Up @@ -4,6 +4,7 @@
Bug fixes

* `render_views` called in a spec can now override the config setting. (martinsvalin)
* Fix render_views for anonymous controllers on 1.8.7. (hudge, mudge)

### 2.9.0 / 2012-03-17
[full changelog](http://github.com/rspec/rspec-rails/compare/v2.8.1...v2.9.0)
Expand Down
6 changes: 3 additions & 3 deletions lib/rspec/rails/example/controller_example_group.rb
Expand Up @@ -58,10 +58,10 @@ def controller(base_class = nil, &body)
controller_class :
ApplicationController

metadata[:example_group][:described_class] = Class.new(base_class, &body)
metadata[:example_group][:described_class].singleton_class.class_eval do
def name; "AnonymousController" end
metadata[:example_group][:described_class] = Class.new(base_class) do
def self.name; "AnonymousController"; end
end
metadata[:example_group][:described_class].class_eval(&body)

before do
@orig_routes, @routes = @routes, ActionDispatch::Routing::RouteSet.new
Expand Down

0 comments on commit 10bba44

Please sign in to comment.