rawongithub/minitest-rails — pull request #4 by kamui (2012-03-02 03:03:26+00:00)
Title: Fix nested describe blocks and incorrect controller_name in Controller specs

In Rails 3.2, nested describe blocks cause a NameError Exception. This is caused by the `#determine_default_controller_class` method in `actionpack-3.2.2/lib/action_controller/test_case.rb`. The method contains a regex that looks for a name ending in "Test", which is the Rails functional test convention. In minitest-spec you're more likely to use:

```ruby
describe ApplicationController do
...
end
```

rather than `ApplicationControllerTest`, which would raise an exception anyway since it's not defined. This patch overrides `#determine_default_controller_class` and returns the last controller name in the nested describe chain so that the controller_name in the testcase is set correctly.

I don't know how common it is that anyone would have 2 controllers blocks, one nested within the other, so I opted to pick the right most controller name.