lib/mobylette/helmet/helpers.rb in mobylette-1.2.0 vs lib/mobylette/helmet/helpers.rb in mobylette-1.2.1
- old
+ new
@@ -8,22 +8,24 @@
included do
cattr_accessor :user_agent
end
-
+ # Force the request to be a mobile request
def force_mobile_request_agent
insert_faker
ActionController::Base.is_mobile_request = true
end
+ # Reset the request mobile agent of the request
def reset_test_request_agent
insert_faker
ActionController::Base.is_mobile_request = false
end
private
+ # includes the faker module for faking mobile requests
def insert_faker
return if ActionController::Base.included_modules.include?(Mobylette::Helmet::Faker)
ActionController::Base.send(:include, Mobylette::Helmet::Faker)
end