spec/support/mocks.rb in rails_locale_detection-2.0.0 vs spec/support/mocks.rb in rails_locale_detection-2.1.0
- old
+ new
@@ -4,21 +4,24 @@
attr_accessor :env, :cookies, :cookie_jar
def initialize
@env = {'HTTP_ACCEPT_LANGUAGE' => ''}
@cookies = {}
- @cookie_jar = ActionDispatch::Cookies::CookieJar.build(self)
+ @cookie_jar = if ::Rails.version.to_s < "5.0"
+ ActionDispatch::Cookies::CookieJar.build(self)
+ else
+ ActionDispatch::Cookies::CookieJar.build(self, @cookies)
+ end
end
def host
"localhost"
end
def ssl?
false
end
-
end
class MockUser
attr_accessor :locale
@@ -40,10 +43,11 @@
return user.locale if user
end
class << self
attr_reader :before_filters
+ attr_reader :before_actions
end
def self.before_filter(*args)
@before_filters ||= []
@before_filters << args
@@ -52,8 +56,13 @@
def self.append_before_filter(*args)
@before_filters ||= []
@before_filters << args
end
+ def self.append_before_action(*args)
+ @before_actions ||= []
+ @before_actions << args
+ end
+
include RailsLocaleDetection::ControllerMethods
include HttpAcceptLanguage::EasyAccess
-end
\ No newline at end of file
+end