@@ -209,34 +209,6 class ActiveSupport::TestCase | |||||
209 | def mail_body(mail) |
|
209 | def mail_body(mail) | |
210 | mail.parts.first.body.encoded |
|
210 | mail.parts.first.body.encoded | |
211 | end |
|
211 | end | |
212 |
|
||||
213 | # Shoulda macros |
|
|||
214 | def self.should_render_404 |
|
|||
215 | should_respond_with :not_found |
|
|||
216 | should_render_template 'common/error' |
|
|||
217 | end |
|
|||
218 |
|
||||
219 | def self.should_have_before_filter(expected_method, options = {}) |
|
|||
220 | should_have_filter('before', expected_method, options) |
|
|||
221 | end |
|
|||
222 |
|
||||
223 | def self.should_have_after_filter(expected_method, options = {}) |
|
|||
224 | should_have_filter('after', expected_method, options) |
|
|||
225 | end |
|
|||
226 |
|
||||
227 | def self.should_have_filter(filter_type, expected_method, options) |
|
|||
228 | description = "have #{filter_type}_filter :#{expected_method}" |
|
|||
229 | description << " with #{options.inspect}" unless options.empty? |
|
|||
230 |
|
||||
231 | should description do |
|
|||
232 | klass = "action_controller/filters/#{filter_type}_filter".classify.constantize |
|
|||
233 | expected = klass.new(:filter, expected_method.to_sym, options) |
|
|||
234 | assert_equal 1, @controller.class.filter_chain.select { |filter| |
|
|||
235 | filter.method == expected.method && filter.kind == expected.kind && |
|
|||
236 | filter.options == expected.options && filter.class == expected.class |
|
|||
237 | }.size |
|
|||
238 | end |
|
|||
239 | end |
|
|||
240 | end |
|
212 | end | |
241 |
|
213 | |||
242 | module Redmine |
|
214 | module Redmine |
General Comments 0
You need to be logged in to leave comments.
Login now