0
@@ -195,6 +195,154 @@ class FiltersTest < ActionController::TestCase
0
+ conditions.each do |condition|
0
+ basic_filters.each do |filter|
0
+ define_method "test_#{filter}_with_if_condition_#{condition.class}_which_returns_true_should_change_company_bio" do
0
+ CompaniesController.send filter.to_sym, 'self.bio = "new bio"', :if => condition
0
+ CompaniesController.bio = 'thoughtbot'
0
+ @controller.flag = true
0
+ assert_equal 'new bio', CompaniesController.bio
0
+ define_method "test_#{filter}_with_if_condition_#{condition.class}_which_returns_false_should_not_change_company_bio" do
0
+ CompaniesController.send filter.to_sym, 'self.bio = "new bio"', :if => condition
0
+ CompaniesController.bio = 'thoughtbot'
0
+ @controller.flag = false
0
+ assert_equal 'thoughtbot', CompaniesController.bio
0
+ define_method "test_#{filter}_with_unless_condition_#{condition.class}_which_returns_true_should_not_change_company_bio" do
0
+ CompaniesController.send filter.to_sym, 'self.bio = "new bio"', :unless => condition
0
+ CompaniesController.bio = 'thoughtbot'
0
+ @controller.flag = true
0
+ assert_equal 'thoughtbot', CompaniesController.bio
0
+ define_method "test_#{filter}_with_unless_condition_#{condition.class}_which_returns_false_should_change_company_bio" do
0
+ CompaniesController.send filter.to_sym, 'self.bio = "new bio"', :unless => condition
0
+ CompaniesController.bio = 'thoughtbot'
0
+ @controller.flag = false
0
+ assert_equal 'new bio', CompaniesController.bio
0
+ define_method "test_#{filter}_with_only_option_with_if_condition_#{condition.class}_which_returns_true_should_change_company_bio" do
0
+ CompaniesController.send filter.to_sym, 'self.bio = "new bio"', :only => :show, :if => condition
0
+ CompaniesController.bio = 'thoughtbot'
0
+ @controller.flag = true
0
+ assert_equal 'thoughtbot', CompaniesController.bio
0
+ assert_equal 'new bio', CompaniesController.bio
0
+ define_method "test_#{filter}_with_only_option_if_condition_#{condition.class}_which_returns_false_should_not_change_company_bio" do
0
+ CompaniesController.send filter.to_sym, 'self.bio = "new bio"', :only => :show, :if => condition
0
+ CompaniesController.bio = 'thoughtbot'
0
+ @controller.flag = false
0
+ assert_equal 'thoughtbot', CompaniesController.bio
0
+ assert_equal 'thoughtbot', CompaniesController.bio
0
+ define_method "test_#{filter}_with_only_option_unless_condition_#{condition.class}_which_returns_true_should_not_change_company_bio" do
0
+ CompaniesController.send filter.to_sym, 'self.bio = "new bio"', :only => :show, :unless => condition
0
+ CompaniesController.bio = 'thoughtbot'
0
+ @controller.flag = true
0
+ assert_equal 'thoughtbot', CompaniesController.bio
0
+ assert_equal 'thoughtbot', CompaniesController.bio
0
+ define_method "test_#{filter}_with_only_option_unless_condition_#{condition.class}_which_returns_false_should_change_company_bio" do
0
+ CompaniesController.send filter.to_sym, 'self.bio = "new bio"', :only => :show, :unless => condition
0
+ CompaniesController.bio = 'thoughtbot'
0
+ @controller.flag = false
0
+ assert_equal 'thoughtbot', CompaniesController.bio
0
+ assert_equal 'new bio', CompaniesController.bio
0
+ define_method "test_#{filter}_with_except_option_with_if_condition_#{condition.class}_which_returns_true_should_change_company_bio" do
0
+ CompaniesController.send filter.to_sym, 'self.bio = "new bio"', :except => :show, :if => condition
0
+ CompaniesController.bio = 'thoughtbot'
0
+ @controller.flag = true
0
+ assert_equal 'thoughtbot', CompaniesController.bio
0
+ assert_equal 'new bio', CompaniesController.bio
0
+ define_method "test_#{filter}_with_except_option_if_condition_#{condition.class}_which_returns_false_should_not_change_company_bio" do
0
+ CompaniesController.send filter.to_sym, 'self.bio = "new bio"', :except => :show, :if => condition
0
+ CompaniesController.bio = 'thoughtbot'
0
+ @controller.flag = false
0
+ assert_equal 'thoughtbot', CompaniesController.bio
0
+ assert_equal 'thoughtbot', CompaniesController.bio
0
+ define_method "test_#{filter}_with_except_option_unless_condition_#{condition.class}_which_returns_true_should_not_change_company_bio" do
0
+ CompaniesController.send filter.to_sym, 'self.bio = "new bio"', :except => :show, :unless => condition
0
+ CompaniesController.bio = 'thoughtbot'
0
+ @controller.flag = true
0
+ assert_equal 'thoughtbot', CompaniesController.bio
0
+ assert_equal 'thoughtbot', CompaniesController.bio
0
+ define_method "test_#{filter}_with_except_option_unless_condition_#{condition.class}_which_returns_false_should_change_company_bio" do
0
+ CompaniesController.send filter.to_sym, 'self.bio = "new bio"', :except => :show, :unless => condition
0
+ CompaniesController.bio = 'thoughtbot'
0
+ @controller.flag = false
0
+ assert_equal 'thoughtbot', CompaniesController.bio
0
+ assert_equal 'new bio', CompaniesController.bio
0
remove_const CompaniesController.to_s if const_defined? CompaniesController.to_s
Comments
No one has commented yet.