Permalink
Browse files

Provide url helpers

  • Loading branch information...
1 parent 25b590c commit 8f33851063bde5987436ce6f588a39b18acbd39b Joe Ferris and Mike Burns committed with jferris Aug 3, 2012
Showing with 19 additions and 0 deletions.
  1. +6 −0 lib/turning/railtie.rb
  2. +13 −0 spec/turning/controller_spec.rb
View
@@ -10,5 +10,11 @@ class Railtie < ::Rails::Railtie
initializer('turning.middleware') do
config.app_middleware.use StaticCascade, config.turning.storage
end
+
+ initializer('turning.url_helpers') do
+ Turning::Controller.class_eval do
+ include Rails.application.routes.url_helpers
+ end
+ end
end
end
@@ -41,6 +41,19 @@ def do_it
renderer.should have_rendered('index', 'index-unassigned', {})
end
+ it 'provides url helpers' do
+ concrete_controller = Class.new(Turning::Controller) do
+ def do_it
+ render 'index', root_path
+ end
+ end
+ renderer = mock_renderer
+
+ concrete_controller.new(renderer).do_it
+
+ renderer.should have_rendered('index', '/', {})
+ end
+
def mock_renderer
stub('mock renderer', render_to_file: nil)
end

0 comments on commit 8f33851

Please sign in to comment.