Permalink
Browse files

Merge pull request #460 from deadlyicon/patch-1

define @routes on demand instead of in before hook (ensures they are present for before hooks that might run earlier)
  • Loading branch information...
2 parents c954554 + c1c2f60 commit 37da9b06e62a58b4d63d6b863da3d8c65ec1b63a @dchelimsky dchelimsky committed Dec 4, 2011
Showing with 4 additions and 5 deletions.
  1. +4 −5 lib/rspec/rails/example/routing_example_group.rb
View
9 lib/rspec/rails/example/routing_example_group.rb
@@ -9,7 +9,10 @@ module RoutingExampleGroup
include RSpec::Rails::Matchers::RoutingMatchers::RouteHelpers
module InstanceMethods
- attr_reader :routes
+
+ def routes
+ @routes ||= ::Rails.application.routes
+ end
private
@@ -20,10 +23,6 @@ def method_missing(m, *args, &block)
included do
metadata[:type] = :routing
-
- before do
- @routes = ::Rails.application.routes
- end
end
end
end

0 comments on commit 37da9b0

Please sign in to comment.