Skip to content

Commit

Permalink
Merge pull request rspec#460 from deadlyicon/patch-1
Browse files Browse the repository at this point in the history
define @routes on demand instead of in before hook (ensures they are present for before hooks that might run earlier)
  • Loading branch information
dchelimsky committed Dec 4, 2011
2 parents c954554 + c1c2f60 commit 37da9b0
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions lib/rspec/rails/example/routing_example_group.rb
Expand Up @@ -9,7 +9,10 @@ module RoutingExampleGroup
include RSpec::Rails::Matchers::RoutingMatchers::RouteHelpers include RSpec::Rails::Matchers::RoutingMatchers::RouteHelpers


module InstanceMethods module InstanceMethods
attr_reader :routes
def routes
@routes ||= ::Rails.application.routes
end


private private


Expand All @@ -20,10 +23,6 @@ def method_missing(m, *args, &block)


included do included do
metadata[:type] = :routing metadata[:type] = :routing

before do
@routes = ::Rails.application.routes
end
end end
end end
end end

0 comments on commit 37da9b0

Please sign in to comment.