Permalink
Browse files

Hook into rails-3 generators using 3.0 and 3.1 APIs

- Rails-3.1 will change the API for hooking into generators from
  "config.generators" to "config.app_generators".
- This commit supports either.
  • Loading branch information...
1 parent ca16b51 commit f5ba00e0302f69e4bb38239d3f02af46e564b575 @dchelimsky dchelimsky committed Oct 2, 2010
Showing with 4 additions and 2 deletions.
  1. +4 −2 lib/rspec-rails.rb
View
@@ -1,8 +1,10 @@
module RSpec
module Rails
class Railtie < ::Rails::Railtie
- config.generators.integration_tool :rspec
- config.generators.test_framework :rspec
+ # Rails-3.0.1 requires config.app_generators instead of 3.0.0's config.generators
+ generators = config.respond_to?(:app_generators) ? config.app_generators : config.generators
+ generators.integration_tool :rspec
+ generators.test_framework :rspec
rake_tasks do
load "rspec/rails/tasks/rspec.rake"

0 comments on commit f5ba00e

Please sign in to comment.