0
@@ -343,6 +343,179 @@ class FiltersTest < ActionController::TestCase
0
+ conditions.each do |condition|
0
+ basic_filters.each do |filter|
0
+ define_method "test_#{filter}_with_block_callback_with_if_condition_#{condition.class}_which_returns_true_should_change_company_name" do
0
+ CompaniesController.send filter.to_sym, :if => condition do |controller|
0
+ controller.change_name
0
+ @controller.name = 'thoughtbot'
0
+ @controller.flag = true
0
+ assert_equal 'new name', @controller.name
0
+ define_method "test_#{filter}_with_block_callback_with_if_condition_#{condition.class}_which_returns_false_should_not_change_company_name" do
0
+ CompaniesController.send filter.to_sym, :if => condition do |controller|
0
+ controller.change_name
0
+ @controller.name = 'thoughtbot'
0
+ @controller.flag = false
0
+ assert_equal 'thoughtbot', @controller.name
0
+ define_method "test_#{filter}_with_block_callback_with_unless_condition_#{condition.class}_which_returns_true_should_not_change_company_name" do
0
+ CompaniesController.send filter.to_sym, :unless => condition do |controller|
0
+ controller.change_name
0
+ @controller.name = 'thoughtbot'
0
+ @controller.flag = true
0
+ assert_equal 'thoughtbot', @controller.name
0
+ define_method "test_#{filter}_with_block_callback_with_unless_condition_#{condition.class}_which_returns_false_should_change_company_name" do
0
+ CompaniesController.send filter.to_sym, :unless => condition do |controller|
0
+ controller.change_name
0
+ @controller.name = 'thoughtbot'
0
+ @controller.flag = false
0
+ assert_equal 'new name', @controller.name
0
+ define_method "test_#{filter}_with_only_option_with_block_callback_with_if_condition_#{condition.class}_which_returns_true_should_change_company_name" do
0
+ CompaniesController.send filter.to_sym, :only => :show, :if => condition do |controller|
0
+ controller.change_name
0
+ @controller.name = 'thoughtbot'
0
+ @controller.flag = true
0
+ assert_equal 'thoughtbot', @controller.name
0
+ assert_equal 'new name', @controller.name
0
+ define_method "test_#{filter}_with_only_option_with_block_callback_with_if_condition_#{condition.class}_which_returns_false_should_not_change_company_name" do
0
+ CompaniesController.send filter.to_sym, :only => :show, :if => condition do |controller|
0
+ controller.change_name
0
+ @controller.name = 'thoughtbot'
0
+ @controller.flag = false
0
+ assert_equal 'thoughtbot', @controller.name
0
+ assert_equal 'thoughtbot', @controller.name
0
+ define_method "test_#{filter}_with_only_option_with_block_callback_with_unless_condition_#{condition.class}_which_returns_true_should_not_change_company_name" do
0
+ CompaniesController.send filter.to_sym, :only => :show, :unless => condition do |controller|
0
+ controller.change_name
0
+ @controller.name = 'thoughtbot'
0
+ @controller.flag = true
0
+ assert_equal 'thoughtbot', @controller.name
0
+ assert_equal 'thoughtbot', @controller.name
0
+ define_method "test_#{filter}_with_only_option_with_block_callback_with_unless_condition_#{condition.class}_which_returns_false_should_change_company_name" do
0
+ CompaniesController.send filter.to_sym, :only => :show, :unless => condition do |controller|
0
+ controller.change_name
0
+ @controller.name = 'thoughtbot'
0
+ @controller.flag = false
0
+ assert_equal 'thoughtbot', @controller.name
0
+ assert_equal 'new name', @controller.name
0
+ define_method "test_#{filter}_with_except_option_with_block_callback_with_if_condition_#{condition.class}_which_returns_true_should_change_company_name" do
0
+ CompaniesController.send filter.to_sym, :except => :show, :if => condition do |controller|
0
+ controller.change_name
0
+ @controller.name = 'thoughtbot'
0
+ @controller.flag = true
0
+ assert_equal 'thoughtbot', @controller.name
0
+ assert_equal 'new name', @controller.name
0
+ define_method "test_#{filter}_with_except_option_with_block_callback_with_if_condition_#{condition.class}_which_returns_false_should_not_change_company_name" do
0
+ CompaniesController.send filter.to_sym, :except => :show, :if => condition do |controller|
0
+ controller.change_name
0
+ @controller.name = 'thoughtbot'
0
+ @controller.flag = false
0
+ assert_equal 'thoughtbot', @controller.name
0
+ assert_equal 'thoughtbot', @controller.name
0
+ define_method "test_#{filter}_with_except_option_with_block_callback_with_unless_condition_#{condition.class}_which_returns_true_should_not_change_company_name" do
0
+ CompaniesController.send filter.to_sym, :except => :show, :unless => condition do |controller|
0
+ controller.change_name
0
+ @controller.name = 'thoughtbot'
0
+ @controller.flag = true
0
+ assert_equal 'thoughtbot', @controller.name
0
+ assert_equal 'thoughtbot', @controller.name
0
+ define_method "test_#{filter}_with_except_option_with_block_callback_with_unless_condition_#{condition.class}_which_returns_false_should_change_company_name" do
0
+ CompaniesController.send filter.to_sym, :except => :show, :unless => condition do |controller|
0
+ controller.change_name
0
+ @controller.name = 'thoughtbot'
0
+ @controller.flag = false
0
+ assert_equal 'thoughtbot', @controller.name
0
+ assert_equal 'new name', @controller.name
0
remove_const CompaniesController.to_s if const_defined? CompaniesController.to_s
Comments
No one has commented yet.