Module: ActionDispatch::TestResponse::DeprecatedHelpers

Included in:
ActionDispatch::TestResponse
Defined in:
actionpack/lib/action_dispatch/testing/test_response.rb

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Instance Attribute Details

- (Object) template



18
19
20
21
# File 'actionpack/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

Instance Method Details

- (Object) assigns



29
30
31
32
# File 'actionpack/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

- (Object) binary_content

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



103
104
105
106
# File 'actionpack/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

- (Object) flash

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



61
62
63
64
# File 'actionpack/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

- (Boolean) has_flash?

Do we have a flash?



67
68
69
70
# File 'actionpack/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

- (Boolean) has_flash_object?(name = nil)

Does the specified flash object exist?



79
80
81
82
# File 'actionpack/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

- (Boolean) has_flash_with_contents?

Do we have a flash that has contents?



73
74
75
76
# File 'actionpack/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

- (Boolean) has_session_object?(name = nil)

Does the specified object exist in the session?



85
86
87
88
# File 'actionpack/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

- (Boolean) has_template_object?(name = nil)

Does the specified template object exist?



97
98
99
100
# File 'actionpack/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

- (Object) layout



34
35
36
37
# File 'actionpack/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

- (Boolean) redirect_url_match?(pattern)



44
45
46
47
48
49
50
51
# File 'actionpack/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

- (Object) redirected_to



39
40
41
42
# File 'actionpack/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

- (Object) rendered

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



55
56
57
58
# File 'actionpack/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

- (Object) session



24
25
26
27
# File 'actionpack/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

- (Object) template_objects

A shortcut to the template.assigns



91
92
93
94
# File 'actionpack/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