Last active
January 3, 2016 01:39
-
-
Save exocode/8390721 to your computer and use it in GitHub Desktop.
# workaround, to set default locale for ALL rspecs https://github.com/rspec/rspec-rails/issues/255
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ActionView::TestCase::TestController | |
def default_url_options(options={}) | |
logged_in = options[ :controller ] =~ /admin/ ? 'members' : nil | |
{ locale: I18n.default_locale, logged_in: logged_in } | |
end | |
end | |
class ActionDispatch::Routing::RouteSet::NamedRouteCollection::UrlHelper | |
def call(t, args) | |
logged_in = @options[ :controller ] =~ /admin/ ? 'members' : nil | |
t.url_for(handle_positional_args(t, args, { locale: I18n.default_locale, logged_in: logged_in }.merge( @options ), @segment_keys)) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment