Permalink
Browse files

Beginnings of 'spree' routing helper for #735

  • Loading branch information...
radar committed Nov 16, 2011
1 parent c052ad0 commit a9c3bcc49ea6a6b0c054ca9e04347ca794eebd55
Showing with 34 additions and 0 deletions.
  1. +16 −0 core/lib/spree/core/rails/route_extensions.rb
  2. +18 −0 core/spec/requests/route_extensions_spec.rb
@@ -0,0 +1,16 @@
module Spree
module Core
module Rails
module RouteExtensions
def spree(options={})
routes = Array.wrap(options[:only]) || [:promo, :auth, :core]
routes.each do |engine|
mount "Spree::#{engine.to_s.classify}::Engine".constantize, :at => "/"
end
end
end
end
end
end
ActionDispatch::Routing::Mapper.send :include, Spree::Core::Rails::RouteExtensions
@@ -0,0 +1,18 @@
require 'spec_helper'
describe Spree::Core::Rails::RouteExtensions do
context "default routes" do
before do
Rails.application.routes.prepend do
spree :only => :core
end
Rails.application.routes_reloader.reload!
end
it "routes to core" do
visit '/'
end
end
end

0 comments on commit a9c3bcc

Please sign in to comment.