module ActionDispatch::TestResponse::DeprecatedHelpers

Attributes

template[W]

Public Instance Methods

assigns() click to toggle source
# File lib/action_dispatch/testing/test_response.rb, line 29
def assigns
  ActiveSupport::Deprecation.warn("response.assigns has been deprecated. Use controller.assigns instead", caller)
  @template.controller.assigns
end
binary_content() click to toggle source

Returns binary content (downloadable file), converted to a String

# File lib/action_dispatch/testing/test_response.rb, line 103
def binary_content
  ActiveSupport::Deprecation.warn("response.binary_content has been deprecated. Use response.body instead", caller)
  body
end
flash() click to toggle source

A shortcut to the flash. Returns an empty hash if no session flash exists.

# File lib/action_dispatch/testing/test_response.rb, line 61
def flash
  ActiveSupport::Deprecation.warn("response.flash has been deprecated. Use request.flash instead", caller)
  request.session['flash'] || {}
end
has_flash?() click to toggle source

Do we have a flash?

# File lib/action_dispatch/testing/test_response.rb, line 67
def has_flash?
  ActiveSupport::Deprecation.warn("response.has_flash? has been deprecated. Use flash.any? instead", caller)
  !flash.empty?
end
has_flash_object?(name=nil) click to toggle source

Does the specified flash object exist?

# File lib/action_dispatch/testing/test_response.rb, line 79
def has_flash_object?(name=nil)
  ActiveSupport::Deprecation.warn("response.has_flash_object? has been deprecated. Use flash[name] instead", caller)
  !flash[name].nil?
end
has_flash_with_contents?() click to toggle source

Do we have a flash that has contents?

# File lib/action_dispatch/testing/test_response.rb, line 73
def has_flash_with_contents?
  ActiveSupport::Deprecation.warn("response.has_flash_with_contents? has been deprecated. Use flash.any? instead", caller)
  !flash.empty?
end
has_session_object?(name=nil) click to toggle source

Does the specified object exist in the session?

# File lib/action_dispatch/testing/test_response.rb, line 85
def has_session_object?(name=nil)
  ActiveSupport::Deprecation.warn("response.has_session_object? has been deprecated. Use session[name] instead", caller)
  !session[name].nil?
end
has_template_object?(name=nil) click to toggle source

Does the specified template object exist?

# File lib/action_dispatch/testing/test_response.rb, line 97
def has_template_object?(name=nil)
  ActiveSupport::Deprecation.warn("response.has_template_object? has been deprecated. Use tempate.assigns[name].nil? instead", caller)
  !template_objects[name].nil?
end
layout() click to toggle source
# File lib/action_dispatch/testing/test_response.rb, line 34
def layout
  ActiveSupport::Deprecation.warn("response.layout has been deprecated. Use template.layout instead", caller)
  @template.layout
end
redirect_url_match?(pattern) click to toggle source
# File lib/action_dispatch/testing/test_response.rb, line 44
def redirect_url_match?(pattern)
  ::ActiveSupport::Deprecation.warn("response.redirect_url_match? is deprecated. Use assert_match(/foo/, response.redirect_url) instead", caller)
  return false if redirect_url.nil?
  p = Regexp.new(pattern) if pattern.class == String
  p = pattern if pattern.class == Regexp
  return false if p.nil?
  p.match(redirect_url) != nil
end
redirected_to() click to toggle source
# File lib/action_dispatch/testing/test_response.rb, line 39
def redirected_to
  ::ActiveSupport::Deprecation.warn("response.redirected_to is deprecated. Use response.redirect_url instead", caller)
  redirect_url
end
rendered() click to toggle source

Returns the template of the file which was used to render this response (or nil)

# File lib/action_dispatch/testing/test_response.rb, line 55
def rendered
  ActiveSupport::Deprecation.warn("response.rendered has been deprecated. Use template.rendered instead", caller)
  @template.instance_variable_get(:@_rendered)
end
session() click to toggle source
# File lib/action_dispatch/testing/test_response.rb, line 24
def session
  ActiveSupport::Deprecation.warn("response.session has been deprecated. Use request.session instead", caller)
  @request.session
end
template() click to toggle source
# File lib/action_dispatch/testing/test_response.rb, line 18
def template
  ActiveSupport::Deprecation.warn("response.template has been deprecated. Use controller.template instead", caller)
  @template
end
template_objects() click to toggle source

A shortcut to the template.assigns

# File lib/action_dispatch/testing/test_response.rb, line 91
def template_objects
  ActiveSupport::Deprecation.warn("response.template_objects has been deprecated. Use template.assigns instead", caller)
  @template.assigns || {}
end