public
Description: Conditional checks on Rails filters
Clone URL: git://github.com/thoughtbot/when.git
added Proc, Method, String support for filters

git-svn-id: https://svn.thoughtbot.com/plugins/when/trunk@343 
7bbfaf0e-4d1d-0410-9690-a8bb5f8ef2aa
dcroak (author)
Thu Feb 14 16:39:34 -0800 2008
commit  9b3b500969d68df700d48e7beed66737b8c902e3
tree    6d5ef51e7b88e34a9b04e726eda812be700e5a40
parent  4fd87e8f012b34379f455a47f146ab2ae049331a
...
20
21
22
23
 
24
25
26
...
20
21
22
 
23
24
25
26
0
@@ -20,7 +20,7 @@ module When
0
                     elsif filter.class == Proc || filter.class == Method
0
                       filter.call(controller)
0
                     else
0
- raise ActiveRecord::ActiveRecordError,
0
+ raise ActionController::ActionControllerError,
0
                         "Filters must be a symbol denoting the method to call, a string to be evaluated, a block to be invoked, or an object responding to the callback method."
0
                     end
0
                   end
...
172
173
174
175
 
176
177
178
...
183
184
185
186
 
187
188
189
...
172
173
174
 
175
176
177
178
...
183
184
185
 
186
187
188
189
0
@@ -172,7 +172,7 @@ class FiltersTest < ActionController::TestCase
0
       end
0
 
0
       define_method "test_#{filter}_with_if_condition_#{condition.class}_which_returns_true_should_raise_an_exception_if_its_callback_is_not_a_supported_type" do
0
- CompaniesController.send filter.to_sym, CompaniesController, :if => condition
0
+ CompaniesController.send filter.to_sym, [], :if => condition
0
 
0
         @controller.name = 'thoughtbot'
0
         @controller.flag = true
0
@@ -183,7 +183,7 @@ class FiltersTest < ActionController::TestCase
0
       end
0
 
0
       define_method "test_#{filter}_with_unless_condition_#{condition.class}_which_returns_true_should_raise_an_exception_if_its_callback_is_not_a_supported_type" do
0
- CompaniesController.send filter.to_sym, CompaniesController, :unless => condition
0
+ CompaniesController.send filter.to_sym, [], :unless => condition
0
 
0
         @controller.name = 'thoughtbot'
0
         @controller.flag = false

Comments

    No one has commented yet.