0
@@ -182,120 +182,108 @@ class CallbacksTest < Test::Unit::TestCase
0
conditions.each do |condition|
0
basic_callbacks.each do |callback|
0
- define_method "test_#{callback}_with_if_condition_#{condition.class}_which_returns_true_should_change_company_bio" do
0
- Company.send callback.to_sym, 'self.bio = "new bio"', :if => condition
0
+ define_method "test_#{callback}_with_string_callback_with_if_condition_#{condition.class}_which_returns_true_should_change_company_name" do
0
+ Company.send callback.to_sym, 'change_name', :if => condition
0
- Company.bio = 'thoughtbot'
0
- company = Company.new :flag => true
0
+ company = Company.new :name => 'thoughtbot', :flag => true
0
- assert_equal 'new
bio', Company.bio0
+ assert_equal 'new
name', company.name0
- define_method "test_#{callback}_with_if_condition_#{condition.class}_which_returns_false_should_not_change_company_bio" do
0
- Company.send callback.to_sym, 'self.bio = "new bio"', :if => condition
0
+ define_method "test_#{callback}_with_string_callback_with_if_condition_#{condition.class}_which_returns_false_should_not_change_company_name" do
0
+ Company.send callback.to_sym, 'change_name', :if => condition
0
- Company.bio = 'thoughtbot'
0
- company = Company.new :flag => false
0
+ company = Company.new :name => 'thoughtbot', :flag => false
0
- assert_equal 'thoughtbot',
Company.bio0
+ assert_equal 'thoughtbot',
company.name0
- define_method "test_#{callback}_with_unless_condition_#{condition.class}_which_returns_true_should_not_change_company_bio" do
0
- Company.send callback.to_sym, 'self.bio = "new bio"', :unless => condition
0
+ define_method "test_#{callback}_with_string_callback_with_unless_condition_#{condition.class}_which_returns_true_should_not_change_company_name" do
0
+ Company.send callback.to_sym, 'change_name', :unless => condition
0
- Company.bio = 'thoughtbot'
0
- company = Company.new :flag => true
0
+ company = Company.new :name => 'thoughtbot', :flag => true
0
- assert_equal 'thoughtbot',
Company.bio0
+ assert_equal 'thoughtbot',
company.name0
- define_method "test_#{callback}_with_unless_condition_#{condition.class}_which_returns_false_should_change_company_bio" do
0
- Company.send callback.to_sym, 'self.bio = "new bio"', :unless => condition
0
+ define_method "test_#{callback}_with_string_callback_with_unless_condition_#{condition.class}_which_returns_false_should_change_company_name" do
0
+ Company.send callback.to_sym, 'change_name', :unless => condition
0
- Company.bio = 'thoughtbot'
0
- company = Company.new :flag => false
0
+ company = Company.new :name => 'thoughtbot', :flag => false
0
- assert_equal 'new
bio', Company.bio0
+ assert_equal 'new
name', company.name0
update_callbacks.each do |callback|
0
- define_method "test_#{callback}_with_if_condition_#{condition.class}_which_returns_true_should_change_company_bio" do
0
- Company.send callback.to_sym, 'self.bio = "new bio"', :if => condition
0
+ define_method "test_#{callback}_with_string_callback_with_if_condition_#{condition.class}_which_returns_true_should_change_company_name" do
0
+ Company.send callback.to_sym, 'change_name', :if => condition
0
- Company.bio = 'thoughtbot'
0
company = Company.create :flag => true
0
- assert_equal 'new
bio', Company.bio0
+ assert_equal 'new
name', company.name0
- define_method "test_#{callback}_with_if_condition_#{condition.class}_which_returns_false_should_not_change_company_bio" do
0
- Company.send callback.to_sym, 'self.bio = "new bio"', :if => condition
0
+ define_method "test_#{callback}_with_string_callback_with_if_condition_#{condition.class}_which_returns_false_should_not_change_company_name" do
0
+ Company.send callback.to_sym, 'change_name', :if => condition
0
- Company.bio = 'thoughtbot'
0
- company = Company.create :flag => false
0
+ company = Company.create :name => 'thoughtbot', :flag => false
0
- assert_equal 'thoughtbot',
Company.bio0
+ assert_equal 'thoughtbot',
company.name0
- define_method "test_#{callback}_with_unless_condition_#{condition.class}_which_returns_true_should_not_change_company_bio" do
0
- Company.send callback.to_sym, 'self.bio = "new bio"', :unless => condition
0
+ define_method "test_#{callback}_with_string_callback_with_unless_condition_#{condition.class}_which_returns_true_should_not_change_company_name" do
0
+ Company.send callback.to_sym, 'change_name', :unless => condition
0
- Company.bio = 'thoughtbot'
0
- company = Company.create :flag => true
0
+ company = Company.create :name => 'thoughtbot', :flag => true
0
- assert_equal 'thoughtbot',
Company.bio0
+ assert_equal 'thoughtbot',
company.name0
- define_method "test_#{callback}_with_unless_condition_#{condition.class}_which_returns_false_should_change_company_bio" do
0
- Company.send callback.to_sym, 'self.bio = "new bio"', :unless => condition
0
+ define_method "test_#{callback}_with_string_callback_with_unless_condition_#{condition.class}_which_returns_false_should_change_company_name" do
0
+ Company.send callback.to_sym, 'change_name', :unless => condition
0
- Company.bio = 'thoughtbot'
0
- company = Company.create :flag => false
0
+ company = Company.create :name => 'thoughtbot', :flag => false
0
- assert_equal 'new
bio', Company.bio0
+ assert_equal 'new
name', company.name0
destroy_callbacks.each do |callback|
0
- define_method "test_#{callback}_with_if_condition_#{condition.class}_which_returns_true_should_toggle_class_flag" do
0
- Company.send callback.to_sym, 'self.flag = ! flag; true;', :if => condition
0
+ define_method "test_#{callback}_with_string_callback_with_if_condition_#{condition.class}_which_returns_true_should_toggle_flag" do
0
+ Company.send callback.to_sym, 'toggle_flag; true', :if => condition
0
company = Company.new :flag => true
0
- define_method "test_#{callback}_with_if_condition_#{condition.class}_which_returns_false_should_not_toggle_class_flag" do
0
- Company.send callback.to_sym, 'self.flag = ! flag', :if => condition
0
+ define_method "test_#{callback}_with_string_callback_with_if_condition_#{condition.class}_which_returns_false_should_not_toggle_flag" do
0
+ Company.send callback.to_sym, 'toggle_flag', :if => condition
0
company = Company.new :flag => false
0
- define_method "test_#{callback}_with_unless_condition_#{condition.class}_which_returns_true_should_not_toggle_class_flag" do
0
- Company.send callback.to_sym, 'self.flag = ! flag', :unless => condition
0
+ define_method "test_#{callback}_with_string_callback_with_unless_condition_#{condition.class}_which_returns_true_should_not_toggle_flag" do
0
+ Company.send callback.to_sym, 'toggle_flag', :unless => condition
0
company = Company.new :flag => true
0
- define_method "test_#{callback}_with_unless_condition_#{condition.class}_which_returns_false_should_toggle_class_flag" do
0
- Company.send callback.to_sym, 'self.flag = ! flag', :unless => condition
0
+ define_method "test_#{callback}_with_string_callback_unless_condition_#{condition.class}_which_returns_false_should_toggle_flag" do
0
+ Company.send callback.to_sym, 'toggle_flag', :unless => condition
0
company = Company.new :flag => false
Comments
No one has commented yet.