Skip to content
This repository
Browse code

Hide the deprecated methods from the docs

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1190 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
commit 72c51356c5e59c73710ee5f3feba57b52a38af81 1 parent dca7efa
David Heinemeier Hansson dhh authored
8 actionpack/lib/action_controller/assertions.rb
@@ -59,8 +59,8 @@ def assert_redirected_to(options = {}, message=nil)
59 59 end
60 60 end
61 61
62   - # Asserts that the request was rendered with the appropriate template file
63   - def assert_template(expected=nil, message=nil)
  62 + # Asserts that the request was rendered with the appropriate template file.
  63 + def assert_template(expected = nil, message=nil)
64 64 rendered = expected ? @response.rendered_file(!expected.include?('/')) : @response.rendered_file
65 65 msg = build_message(message, "expecting <?> but rendering with <?>", expected, rendered)
66 66 assert_block(msg) do
@@ -72,10 +72,6 @@ def assert_template(expected=nil, message=nil)
72 72 end
73 73 end
74 74
75   - alias_method :assert_rendered_file, :assert_template #:nodoc:
76   -
77   - # -- routing assertions --------------------------------------------------
78   -
79 75 # Asserts that the routing of the given path is handled correctly and that the parsed options match.
80 76 def assert_recognizes(expected_options, path, extras={}, message=nil)
81 77 # Load routes.rb if it hasn't been loaded.
54 actionpack/lib/action_controller/deprecated_assertions.rb
@@ -4,41 +4,45 @@
4 4
5 5 module Test #:nodoc:
6 6 module Unit #:nodoc:
7   - module Assertions #:nodoc:
8   - def assert_success(message=nil)
  7 + module Assertions
  8 + def assert_success(message=nil) #:nodoc:
9 9 assert_response(:success, message)
10 10 end
11 11
12   - def assert_redirect(message=nil)
  12 + def assert_redirect(message=nil) #:nodoc:
13 13 assert_response(:redirect, message)
14 14 end
15 15
  16 + def assert_rendered_file(expected=nil, message=nil) #:nodoc:
  17 + assert_template(expected, message)
  18 + end
  19 +
16 20 # ensure that the session has an object with the specified name
17   - def assert_session_has(key=nil, message=nil)
  21 + def assert_session_has(key=nil, message=nil) #:nodoc:
18 22 msg = build_message(message, "<?> is not in the session <?>", key, @response.session)
19 23 assert_block(msg) { @response.has_session_object?(key) }
20 24 end
21 25
22 26 # ensure that the session has no object with the specified name
23   - def assert_session_has_no(key=nil, message=nil)
  27 + def assert_session_has_no(key=nil, message=nil) #:nodoc:
24 28 msg = build_message(message, "<?> is in the session <?>", key, @response.session)
25 29 assert_block(msg) { !@response.has_session_object?(key) }
26 30 end
27 31
28   - def assert_session_equal(expected = nil, key = nil, message = nil)
  32 + def assert_session_equal(expected = nil, key = nil, message = nil) #:nodoc:
29 33 msg = build_message(message, "<?> expected in session['?'] but was <?>", expected, key, @response.session[key])
30 34 assert_block(msg) { expected == @response.session[key] }
31 35 end
32 36
33 37 # -- cookie assertions ---------------------------------------------------
34 38
35   - def assert_no_cookie(key = nil, message = nil)
  39 + def assert_no_cookie(key = nil, message = nil) #:nodoc:
36 40 actual = @response.cookies[key]
37 41 msg = build_message(message, "<?> not expected in cookies['?']", actual, key)
38 42 assert_block(msg) { actual.nil? or actual.empty? }
39 43 end
40 44
41   - def assert_cookie_equal(expected = nil, key = nil, message = nil)
  45 + def assert_cookie_equal(expected = nil, key = nil, message = nil) #:nodoc:
42 46 actual = @response.cookies[key]
43 47 actual = actual.first if actual
44 48 msg = build_message(message, "<?> expected in cookies['?'] but was <?>", expected, key, actual)
@@ -48,56 +52,56 @@ def assert_cookie_equal(expected = nil, key = nil, message = nil)
48 52 # -- flash assertions ---------------------------------------------------
49 53
50 54 # ensure that the flash has an object with the specified name
51   - def assert_flash_has(key=nil, message=nil)
  55 + def assert_flash_has(key=nil, message=nil) #:nodoc:
52 56 msg = build_message(message, "<?> is not in the flash <?>", key, @response.flash)
53 57 assert_block(msg) { @response.has_flash_object?(key) }
54 58 end
55 59
56 60 # ensure that the flash has no object with the specified name
57   - def assert_flash_has_no(key=nil, message=nil)
  61 + def assert_flash_has_no(key=nil, message=nil) #:nodoc:
58 62 msg = build_message(message, "<?> is in the flash <?>", key, @response.flash)
59 63 assert_block(msg) { !@response.has_flash_object?(key) }
60 64 end
61 65
62 66 # ensure the flash exists
63   - def assert_flash_exists(message=nil)
  67 + def assert_flash_exists(message=nil) #:nodoc:
64 68 msg = build_message(message, "the flash does not exist <?>", @response.session['flash'] )
65 69 assert_block(msg) { @response.has_flash? }
66 70 end
67 71
68 72 # ensure the flash does not exist
69   - def assert_flash_not_exists(message=nil)
  73 + def assert_flash_not_exists(message=nil) #:nodoc:
70 74 msg = build_message(message, "the flash exists <?>", @response.flash)
71 75 assert_block(msg) { !@response.has_flash? }
72 76 end
73 77
74 78 # ensure the flash is empty but existent
75   - def assert_flash_empty(message=nil)
  79 + def assert_flash_empty(message=nil) #:nodoc:
76 80 msg = build_message(message, "the flash is not empty <?>", @response.flash)
77 81 assert_block(msg) { !@response.has_flash_with_contents? }
78 82 end
79 83
80 84 # ensure the flash is not empty
81   - def assert_flash_not_empty(message=nil)
  85 + def assert_flash_not_empty(message=nil) #:nodoc:
82 86 msg = build_message(message, "the flash is empty")
83 87 assert_block(msg) { @response.has_flash_with_contents? }
84 88 end
85 89
86   - def assert_flash_equal(expected = nil, key = nil, message = nil)
  90 + def assert_flash_equal(expected = nil, key = nil, message = nil) #:nodoc:
87 91 msg = build_message(message, "<?> expected in flash['?'] but was <?>", expected, key, @response.flash[key])
88 92 assert_block(msg) { expected == @response.flash[key] }
89 93 end
90 94
91 95
92 96 # ensure our redirection url is an exact match
93   - def assert_redirect_url(url=nil, message=nil)
  97 + def assert_redirect_url(url=nil, message=nil) #:nodoc:
94 98 assert_redirect(message)
95 99 msg = build_message(message, "<?> is not the redirected location <?>", url, @response.redirect_url)
96 100 assert_block(msg) { @response.redirect_url == url }
97 101 end
98 102
99 103 # ensure our redirection url matches a pattern
100   - def assert_redirect_url_match(pattern=nil, message=nil)
  104 + def assert_redirect_url_match(pattern=nil, message=nil) #:nodoc:
101 105 assert_redirect(message)
102 106 msg = build_message(message, "<?> was not found in the location: <?>", pattern, @response.redirect_url)
103 107 assert_block(msg) { @response.redirect_url_match?(pattern) }
@@ -107,19 +111,19 @@ def assert_redirect_url_match(pattern=nil, message=nil)
107 111 # -- template assertions ------------------------------------------------
108 112
109 113 # ensure that a template object with the given name exists
110   - def assert_template_has(key=nil, message=nil)
  114 + def assert_template_has(key=nil, message=nil) #:nodoc:
111 115 msg = build_message(message, "<?> is not a template object", key )
112 116 assert_block(msg) { @response.has_template_object?(key) }
113 117 end
114 118
115 119 # ensure that a template object with the given name does not exist
116   - def assert_template_has_no(key=nil,message=nil)
  120 + def assert_template_has_no(key=nil,message=nil) #:nodoc:
117 121 msg = build_message(message, "<?> is a template object <?>", key, @response.template_objects[key])
118 122 assert_block(msg) { !@response.has_template_object?(key) }
119 123 end
120 124
121 125 # ensures that the object assigned to the template on +key+ is equal to +expected+ object.
122   - def assert_template_equal(expected = nil, key = nil, message = nil)
  126 + def assert_template_equal(expected = nil, key = nil, message = nil) #:nodoc:
123 127 msg = build_message(message, "<?> expected in assigns['?'] but was <?>", expected, key, @response.template.assigns[key.to_s])
124 128 assert_block(msg) { expected == @response.template.assigns[key.to_s] }
125 129 end
@@ -127,7 +131,7 @@ def assert_template_equal(expected = nil, key = nil, message = nil)
127 131
128 132 # Asserts that the template returns the +expected+ string or array based on the XPath +expression+.
129 133 # This will only work if the template rendered a valid XML document.
130   - def assert_template_xpath_match(expression=nil, expected=nil, message=nil)
  134 + def assert_template_xpath_match(expression=nil, expected=nil, message=nil) #:nodoc:
131 135 xml, matches = REXML::Document.new(@response.body), []
132 136 xml.elements.each(expression) { |e| matches << e.text }
133 137 if matches.empty? then
@@ -143,21 +147,21 @@ def assert_template_xpath_match(expression=nil, expected=nil, message=nil)
143 147 end
144 148
145 149 # Assert the template object with the given name is an Active Record descendant and is valid.
146   - def assert_valid_record(key = nil, message = nil)
  150 + def assert_valid_record(key = nil, message = nil) #:nodoc:
147 151 record = find_record_in_template(key)
148 152 msg = build_message(message, "Active Record is invalid <?>)", record.errors.full_messages)
149 153 assert_block(msg) { record.valid? }
150 154 end
151 155
152 156 # Assert the template object with the given name is an Active Record descendant and is invalid.
153   - def assert_invalid_record(key = nil, message = nil)
  157 + def assert_invalid_record(key = nil, message = nil) #:nodoc:
154 158 record = find_record_in_template(key)
155 159 msg = build_message(message, "Active Record is valid)")
156 160 assert_block(msg) { !record.valid? }
157 161 end
158 162
159 163 # Assert the template object with the given name is an Active Record descendant and the specified column(s) are valid.
160   - def assert_valid_column_on_record(key = nil, columns = "", message = nil)
  164 + def assert_valid_column_on_record(key = nil, columns = "", message = nil) #:nodoc:
161 165 record = find_record_in_template(key)
162 166 record.send(:validate)
163 167
@@ -168,7 +172,7 @@ def assert_valid_column_on_record(key = nil, columns = "", message = nil)
168 172 end
169 173
170 174 # Assert the template object with the given name is an Active Record descendant and the specified column(s) are invalid.
171   - def assert_invalid_column_on_record(key = nil, columns = "", message = nil)
  175 + def assert_invalid_column_on_record(key = nil, columns = "", message = nil) #:nodoc:
172 176 record = find_record_in_template(key)
173 177 record.send(:validate)
174 178

0 comments on commit 72c5135

Please sign in to comment.
Something went wrong with that request. Please try again.