Permalink
Browse files

Fix namescape

  • Loading branch information...
ZenCocoon committed Mar 1, 2011
1 parent cbd4fb8 commit d192bf2ab25a99e5980f98a71fd536e3d63ecf21
@@ -1,5 +1,3 @@
-module RoutingFilter
- module LocaleUnlessApi
- require 'routing_filter_locale_unless_api/locale_unless_api'
- end
+module RoutingFilterLocaleUnlessApi
+ require 'routing_filter_locale_unless_api/locale_unless_api'
end
@@ -30,7 +30,7 @@
require 'i18n'
module RoutingFilter
- class Locale < Filter
+ class LocaleUnlessApi < Filter
@@api_formats = %w( xml json )
cattr_writer :api_formats
@@ -1,5 +1,3 @@
-module RoutingFilter
- module LocaleUnlessApi
- VERSION = "0.0.1"
- end
+module RoutingFilterLocaleUnlessApi
+ VERSION = "0.0.1"
end
@@ -8,13 +8,13 @@ def setup
I18n.default_locale = :en
I18n.available_locales = %w(fr en)
- RoutingFilter::Locale.api_formats = %w( xml json )
+ RoutingFilter::LocaleUnlessApi.api_formats = %w( xml json )
@root = { :controller => 'some', :action => 'index' }
@params = { :controller => 'some', :action => 'show', :id => '1' }
@routes = draw_routes do
- filter :locale
+ filter :locale_unless_api
match 'products/:id', :to => 'some#show'
root :to => 'some#index'
end
@@ -37,7 +37,7 @@ def setup
end
test 'recognizes the path /en' do
- assert_equal root.merge(:locale => 'en'), routes.recognize_path('/en')
+ assert_equal root.merge(:locale => 'en'), routes.recognize_path('/en/')
end
test 'recognizes the path /fr' do
@@ -86,7 +86,7 @@ def setup
test 'does not prepend the segments /:locale to the generated path if the format XLS is considered as api' do
I18n.locale = 'fr'
- RoutingFilter::Locale.api_formats = %w( xml json xls )
+ RoutingFilter::LocaleUnlessApi.api_formats = %w( xml json xls )
assert_equal '/products/1.xls', routes.generate(params.merge(:format => 'xls'))
end
@@ -120,7 +120,7 @@ def setup
end
test 'does not prepend the segments /:locale to the generated path if a given locale and the format XLS is considered as api' do
- RoutingFilter::Locale.api_formats = %w( xml json xls )
+ RoutingFilter::LocaleUnlessApi.api_formats = %w( xml json xls )
assert_equal '/products/1.xls', routes.generate(params.merge(:format => 'xls', :locale => 'fr'))
end
end

0 comments on commit d192bf2

Please sign in to comment.