Skip to content
Browse files

test and README files

git-svn-id: https://svn.thoughtbot.com/plugins/when/trunk@307 7bbfaf0e-4d1d-0410-9690-a8bb5f8ef2aa
  • Loading branch information...
1 parent 74f68a2 commit edbcecf6e3e769d1b526795d64ef65dc2680f685 dcroak committed Feb 12, 2008
Showing with 2,463 additions and 8 deletions.
  1. +88 −3 README
  2. +1 −1 Rakefile
  3. +6 −0 test/database.yml
  4. +918 −0 test/fixtures/company.rb
  5. +5 −0 test/schema.rb
  6. +9 −0 test/test_helper.rb
  7. +1,436 −4 test/when_test.rb
View
91 README
@@ -1,13 +1,98 @@
When
====
-Introduction goes here.
+When adds :if and :unless conditions to ActiveRecord callbacks
+and validations. It works exactly the way as the current implementation
+of validates_acceptance_of.
+It works on all 14 callbacks:
+
+before_validation
+before_validation_on_create
+after_validation
+after_validation_on_create
+before_save
+before_create
+before_update
+after_create
+after_update
+after_save
+before_destroy
+after_destroy
+after_initialize
+after_find
+
+and 3 validations:
+
+validate
+validate_on_create
+validate_on_update
+
+It works when :if or :unless is passed symbols, lambdas, and strings.
+They should return or evaluate to a true or false value.
Example
=======
-Example goes here.
+class Address < ActiveRecord::Base
+ before_save :geolocate
+
+ def geolocate
+ if self.complete?
+ ...
+ end
+ end
+
+ def complete?
+ street? && city? && state? && zip?
+ end
+end
+
+In this case, we want to find the latitude and longitude of an address only if
+the address is complete.
+
+Wrapping the entirety of a callback method with conditional logic is bad form.
+The callback should execute WHEN the model's life cycle reaches its
+"before_save" point and WHEN its address is "complete."
+
+With When, the WHEN responsibility is moved to where it belongs:
+as part of the callback.
+
+class Address < ActiveRecord::Base
+ before_save :geolocate, :if => :complete?
+
+ def geolocate
+ ...
+ end
+
+ def complete?
+ street? && city? && state? && zip?
+ end
+end
+
+The callback's single responsibility is to execute code WHEN certain conditions are met.
+The geolocate method's single responsibility is to ... geolocate.
+
+More Examples
+=============
+
+after_update :send_notifications, :unless => lambda {|record| record.minor_change?}
+
+after_initialize :capitalize_title, :if => :new_record?
+
+before_create %{self.password = password.to_sha1},
+ :unless => lambda {|user| user.password_confirmation.blank?}
+
+before_create :unless => lambda {|user| user.password_confirmation.blank?} do |record|
+ record.password = record.password.to_sha1
+end
+
+before_create PasswordEncryptor, :unless => lambda {|user| user.password_confirmation.blank?}
+class PasswordEncryptor
+ def self.before_create(record)
+ record.password = record.password.to_sha1
+ end
+end
-Copyright (c) 2008 [name of plugin creator], released under the MIT license
+Copyright (c) 2008 Jared Carroll, released under the MIT license
View
2 Rakefile
@@ -15,7 +15,7 @@ end
desc 'Generate documentation for the when plugin.'
Rake::RDocTask.new(:rdoc) do |rdoc|
rdoc.rdoc_dir = 'rdoc'
- rdoc.title = 'When'
+ rdoc.title = 'ARCallbackConditions'
rdoc.options << '--line-numbers' << '--inline-source'
rdoc.rdoc_files.include('README')
rdoc.rdoc_files.include('lib/**/*.rb')
View
6 test/database.yml
@@ -0,0 +1,6 @@
+test:
+ adapter: mysql
+ database: ar_callback_conditions
+ host: localhost
+ username: root
+ password:
View
918 test/fixtures/company.rb
@@ -0,0 +1,918 @@
+class Company < ActiveRecord::Base
+
+ (1..114).each do |each|
+ attr_accessor :"attribute_#{each}"
+ end
+
+ before_create :before_create_if_with_proc_condition,
+ :if => lambda {|company| company.attribute_1 == 'before_create_if_with_proc_condition'}
+ before_create :before_create_unless_with_proc_condition,
+ :unless => lambda {|company| company.attribute_2 == 'before_create_unless_with_proc_condition'}
+
+ def before_create_if_with_proc_condition
+ self.attribute_1 = 'attribute_1'
+ end
+
+ def before_create_unless_with_proc_condition
+ self.attribute_2 = 'attribute_2'
+ end
+
+ after_create :after_create_if_with_proc_condition,
+ :if => lambda {|company| company.attribute_3 == 'after_create_if_with_proc_condition'}
+ after_create :after_create_unless_with_proc_condition,
+ :unless => lambda {|company| company.attribute_4 == 'after_create_unless_with_proc_condition'}
+
+ def after_create_if_with_proc_condition
+ self.attribute_3 = 'attribute_3'
+ end
+
+ def after_create_unless_with_proc_condition
+ self.attribute_4 = 'attribute_4'
+ end
+
+ before_save :before_save_if_with_proc_condition,
+ :if => lambda {|company| company.attribute_5 == 'before_save_if_with_proc_condition'}
+ before_save :before_save_unless_with_proc_condition,
+ :unless => lambda {|company| company.attribute_6 == 'before_save_unless_with_proc_condition'}
+
+ def before_save_if_with_proc_condition
+ self.attribute_5 = 'attribute_5'
+ end
+
+ def before_save_unless_with_proc_condition
+ self.attribute_6 = 'attribute_6'
+ end
+
+ after_save :after_save_if_with_proc_condition,
+ :if => lambda {|company| company.attribute_7 == 'after_save_if_with_proc_condition'}
+ after_save :after_save_unless_with_proc_condition,
+ :unless => lambda {|company| company.attribute_8 == 'after_save_unless_with_proc_condition'}
+
+ def after_save_if_with_proc_condition
+ self.attribute_7 = 'attribute_7'
+ end
+
+ def after_save_unless_with_proc_condition
+ self.attribute_8 = 'attribute_8'
+ end
+
+ before_destroy :before_destroy_if_with_proc_condition,
+ :if => lambda {|company| company.attribute_9 == 'before_destroy_if_with_proc_condition'}
+ before_destroy :before_destroy_unless_with_proc_condition,
+ :unless => lambda {|company| company.attribute_10 == 'before_destroy_unless_with_proc_condition'}
+
+ def before_destroy_if_with_proc_condition
+ self.attribute_9 = 'attribute_9'
+ end
+
+ def before_destroy_unless_with_proc_condition
+ self.attribute_10 = 'attribute_10'
+ end
+
+ after_destroy :after_destroy_if_with_proc_condition,
+ :if => lambda {|company| company.attribute_11 == 'after_destroy_if_with_proc_condition'}
+ after_destroy :after_destroy_unless_with_proc_condition,
+ :unless => lambda {|company| company.attribute_12 == 'after_destroy_unless_with_proc_condition'}
+
+ def after_destroy_if_with_proc_condition
+ self.attribute_11 = 'attribute_11'
+ end
+
+ def after_destroy_unless_with_proc_condition
+ self.attribute_12 = 'attribute_12'
+ end
+
+ before_update :before_update_if_with_proc_condition,
+ :if => lambda {|company| company.attribute_13 == 'before_update_if_with_proc_condition'}
+ before_update :before_update_unless_with_proc_condition,
+ :unless => lambda {|company| company.attribute_14 == 'before_update_unless_with_proc_condition'}
+
+ def before_update_if_with_proc_condition
+ self.attribute_13 = 'attribute_13'
+ end
+
+ def before_update_unless_with_proc_condition
+ self.attribute_14 = 'attribute_14'
+ end
+
+ after_update :after_update_if_with_proc_condition,
+ :if => lambda {|company| company.attribute_15 == 'after_update_if_with_proc_condition'}
+ after_update :after_update_unless_with_proc_condition,
+ :unless => lambda {|company| company.attribute_16 == 'after_update_unless_with_proc_condition'}
+
+ def after_update_if_with_proc_condition
+ self.attribute_15 = 'attribute_15'
+ end
+
+ def after_update_unless_with_proc_condition
+ self.attribute_16 = 'attribute_16'
+ end
+
+ before_validation :before_validation_if_with_proc_condition,
+ :if => lambda {|company| company.attribute_17 == 'before_validation_if_with_proc_condition'}
+ before_validation :before_validation_unless_with_proc_condition,
+ :unless => lambda {|company| company.attribute_18 == 'before_validation_unless_with_proc_condition'}
+
+ def before_validation_if_with_proc_condition
+ self.attribute_17 = 'attribute_17'
+ end
+
+ def before_validation_unless_with_proc_condition
+ self.attribute_18 = 'attribute_18'
+ end
+
+ after_validation :after_validation_if_with_proc_condition,
+ :if => lambda {|company| company.attribute_19 == 'after_validation_if_with_proc_condition'}
+ after_validation :after_validation_unless_with_proc_condition,
+ :unless => lambda {|company| company.attribute_20 == 'after_validation_unless_with_proc_condition'}
+
+ def after_validation_if_with_proc_condition
+ self.attribute_19 = 'attribute_19'
+ end
+
+ def after_validation_unless_with_proc_condition
+ self.attribute_20 = 'attribute_20'
+ end
+
+ before_validation_on_create :before_validation_on_create_if_with_proc_condition,
+ :if => lambda {|company| company.attribute_21 == 'before_validation_on_create_if_with_proc_condition'}
+ before_validation_on_create :before_validation_on_create_unless_with_proc_condition,
+ :unless => lambda {|company| company.attribute_22 == 'before_validation_on_create_unless_with_proc_condition'}
+
+ def before_validation_on_create_if_with_proc_condition
+ self.attribute_21 = 'attribute_21'
+ end
+
+ def before_validation_on_create_unless_with_proc_condition
+ self.attribute_22 = 'attribute_22'
+ end
+
+ after_validation_on_create :after_validation_on_create_if_with_proc_condition,
+ :if => lambda {|company| company.attribute_23 == 'after_validation_on_create_if_with_proc_condition'}
+ after_validation_on_create :after_validation_on_create_unless_with_proc_condition,
+ :unless => lambda {|company| company.attribute_24 == 'after_validation_on_create_unless_with_proc_condition'}
+
+ def after_validation_on_create_if_with_proc_condition
+ self.attribute_23 = 'attribute_23'
+ end
+
+ def after_validation_on_create_unless_with_proc_condition
+ self.attribute_24 = 'attribute_24'
+ end
+
+ before_validation_on_update :before_validation_on_update_if_with_proc_condition,
+ :if => lambda {|company| company.attribute_25 == 'before_validation_on_update_if_with_proc_condition'}
+ before_validation_on_update :before_validation_on_update_unless_with_proc_condition,
+ :unless => lambda {|company| company.attribute_26 == 'before_validation_on_update_unless_with_proc_condition'}
+
+ def before_validation_on_update_if_with_proc_condition
+ self.attribute_25 = 'attribute_25'
+ end
+
+ def before_validation_on_update_unless_with_proc_condition
+ self.attribute_26 = 'attribute_26'
+ end
+
+ after_validation_on_update :after_validation_on_update_if_with_proc_condition,
+ :if => lambda {|company| company.attribute_27 == 'after_validation_on_update_if_with_proc_condition'}
+ after_validation_on_update :after_validation_on_update_unless_with_proc_condition,
+ :unless => lambda {|company| company.attribute_28 == 'after_validation_on_update_unless_with_proc_condition'}
+
+ def after_validation_on_update_if_with_proc_condition
+ self.attribute_27 = 'attribute_27'
+ end
+
+ def after_validation_on_update_unless_with_proc_condition
+ self.attribute_28 = 'attribute_28'
+ end
+
+ after_initialize :after_initialize_if_with_proc_condition,
+ :if => lambda {|company| company.attribute_29 == 'after_initialize_if_with_proc_condition'}
+ after_initialize :after_initialize_unless_with_proc_condition,
+ :unless => lambda {|company| company.attribute_30 == 'after_initialize_unless_with_proc_condition'}
+
+ def after_initialize
+ end
+
+ def after_initialize_if_with_proc_condition
+ self.attribute_29 = 'attribute_29'
+ end
+
+ def after_initialize_unless_with_proc_condition
+ self.attribute_30 = 'attribute_30'
+ end
+
+ after_find :after_find_if_with_proc_condition,
+ :if => lambda {|company| company.name == 'after_find_if_with_proc_condition'}
+ after_find :after_find_unless_with_proc_condition,
+ :unless => lambda {|company| company.name == 'after_find_unless_with_proc_condition'}
+
+ def after_find
+ end
+
+ def after_find_if_with_proc_condition
+ self.attribute_31 = 'attribute_31'
+ end
+
+ def after_find_unless_with_proc_condition
+ self.attribute_32 = 'attribute_32'
+ end
+
+ validate :validate_if_with_proc_condition,
+ :if => lambda {|company| company.attribute_33 == 'validate_if_with_proc_condition'}
+ validate :validate_unless_with_proc_condition,
+ :unless => lambda {|company| company.attribute_34 == 'validate_unless_with_proc_condition'}
+
+ def validate_if_with_proc_condition
+ self.attribute_33 = 'attribute_33'
+ end
+
+ def validate_unless_with_proc_condition
+ self.attribute_34 = 'attribute_34'
+ end
+
+ validate_on_create :validate_on_create_if_with_proc_condition,
+ :if => lambda {|company| company.attribute_35 == 'validate_on_create_if_with_proc_condition'}
+ validate_on_create :validate_on_create_unless_with_proc_condition,
+ :unless => lambda {|company| company.attribute_36 == 'validate_on_create_unless_with_proc_condition'}
+
+ def validate_on_create_if_with_proc_condition
+ self.attribute_35 = 'attribute_35'
+ end
+
+ def validate_on_create_unless_with_proc_condition
+ self.attribute_36 = 'attribute_36'
+ end
+
+ validate_on_update :validate_on_update_if_with_proc_condition,
+ :if => lambda {|company| company.attribute_37 == 'validate_on_update_if_with_proc_condition'}
+ validate_on_update :validate_on_update_unless_with_proc_condition,
+ :unless => lambda {|company| company.attribute_38 == 'validate_on_update_unless_with_proc_condition'}
+
+ def validate_on_update_if_with_proc_condition
+ self.attribute_37 = 'attribute_37'
+ end
+
+ def validate_on_update_unless_with_proc_condition
+ self.attribute_38 = 'attribute_38'
+ end
+
+ before_create :before_create_if_with_string_condition,
+ :if => 'attribute_39 == "before_create_if_with_string_condition"'
+ before_create :before_create_unless_with_string_condition,
+ :unless => 'attribute_40 == "before_create_unless_with_string_condition"'
+
+ def before_create_if_with_string_condition
+ self.attribute_39 = 'attribute_39'
+ end
+
+ def before_create_unless_with_string_condition
+ self.attribute_40 = 'attribute_40'
+ end
+
+ after_create :after_create_if_with_string_condition,
+ :if => 'attribute_41 == "after_create_if_with_string_condition"'
+ after_create :after_create_unless_with_string_condition,
+ :unless => 'attribute_42 == "after_create_unless_with_string_condition"'
+
+ def after_create_if_with_string_condition
+ self.attribute_41 = 'attribute_41'
+ end
+
+ def after_create_unless_with_string_condition
+ self.attribute_42 = 'attribute_42'
+ end
+
+ before_save :before_save_if_with_string_condition,
+ :if => 'attribute_43 == "before_save_if_with_string_condition"'
+ before_save :before_save_unless_with_string_condition,
+ :unless => 'attribute_44 == "before_save_unless_with_string_condition"'
+
+ def before_save_if_with_string_condition
+ self.attribute_43 = 'attribute_43'
+ end
+
+ def before_save_unless_with_string_condition
+ self.attribute_44 = 'attribute_44'
+ end
+
+ after_save :after_save_if_with_string_condition,
+ :if => 'attribute_45 == "after_save_if_with_string_condition"'
+ after_save :after_save_unless_with_string_condition,
+ :unless => 'attribute_46 == "after_save_unless_with_string_condition"'
+
+ def after_save_if_with_string_condition
+ self.attribute_45 = 'attribute_45'
+ end
+
+ def after_save_unless_with_string_condition
+ self.attribute_46 = 'attribute_46'
+ end
+
+ before_destroy :before_destroy_if_with_string_condition,
+ :if => 'attribute_47 == "before_destroy_if_with_string_condition"'
+ before_destroy :before_destroy_unless_with_string_condition,
+ :unless => 'attribute_48 == "before_destroy_unless_with_string_condition"'
+
+ def before_destroy_if_with_string_condition
+ self.attribute_47 = 'attribute_47'
+ end
+
+ def before_destroy_unless_with_string_condition
+ self.attribute_48 = 'attribute_48'
+ end
+
+ after_destroy :after_destroy_if_with_string_condition,
+ :if => 'attribute_49 == "after_destroy_if_with_string_condition"'
+ after_destroy :after_destroy_unless_with_string_condition,
+ :unless => 'attribute_50 == "after_destroy_unless_with_string_condition"'
+
+ def after_destroy_if_with_string_condition
+ self.attribute_49 = 'attribute_49'
+ end
+
+ def after_destroy_unless_with_string_condition
+ self.attribute_50 = 'attribute_50'
+ end
+
+ before_update :before_update_if_with_string_condition,
+ :if => 'attribute_51 == "before_update_if_with_string_condition"'
+ before_update :before_update_unless_with_string_condition,
+ :unless => 'attribute_52 == "before_update_unless_with_string_condition"'
+
+ def before_update_if_with_string_condition
+ self.attribute_51 = 'attribute_51'
+ end
+
+ def before_update_unless_with_string_condition
+ self.attribute_52 = 'attribute_52'
+ end
+
+ after_update :after_update_if_with_string_condition,
+ :if => 'attribute_53 == "after_update_if_with_string_condition"'
+ after_update :after_update_unless_with_string_condition,
+ :unless => 'attribute_54 == "after_update_unless_with_string_condition"'
+
+ def after_update_if_with_string_condition
+ self.attribute_53 = 'attribute_53'
+ end
+
+ def after_update_unless_with_string_condition
+ self.attribute_54 = 'attribute_54'
+ end
+
+ before_validation :before_validation_if_with_string_condition,
+ :if => 'attribute_55 == "before_validation_if_with_string_condition"'
+ before_validation :before_validation_unless_with_string_condition,
+ :unless => 'attribute_56 == "before_validation_unless_with_string_condition"'
+
+ def before_validation_if_with_string_condition
+ self.attribute_55 = 'attribute_55'
+ end
+
+ def before_validation_unless_with_string_condition
+ self.attribute_56 = 'attribute_56'
+ end
+
+ after_validation :after_validation_if_with_string_condition,
+ :if => 'attribute_57 == "after_validation_if_with_string_condition"'
+ after_validation :after_validation_unless_with_string_condition,
+ :unless => 'attribute_58 == "after_validation_unless_with_string_condition"'
+
+ def after_validation_if_with_string_condition
+ self.attribute_57 = 'attribute_57'
+ end
+
+ def after_validation_unless_with_string_condition
+ self.attribute_58 = 'attribute_58'
+ end
+
+ before_validation_on_create :before_validation_on_create_if_with_string_condition,
+ :if => 'attribute_59 == "before_validation_on_create_if_with_string_condition"'
+ before_validation_on_create :before_validation_on_create_unless_with_string_condition,
+ :unless => 'attribute_60 == "before_validation_on_create_unless_with_string_condition"'
+
+ def before_validation_on_create_if_with_string_condition
+ self.attribute_59 = 'attribute_59'
+ end
+
+ def before_validation_on_create_unless_with_string_condition
+ self.attribute_60 = 'attribute_60'
+ end
+
+ after_validation_on_create :after_validation_on_create_if_with_string_condition,
+ :if => 'attribute_61 == "after_validation_on_create_if_with_string_condition"'
+ after_validation_on_create :after_validation_on_create_unless_with_string_condition,
+ :unless => 'attribute_62 == "after_validation_on_create_unless_with_string_condition"'
+
+ def after_validation_on_create_if_with_string_condition
+ self.attribute_61 = 'attribute_61'
+ end
+
+ def after_validation_on_create_unless_with_string_condition
+ self.attribute_62 = 'attribute_62'
+ end
+
+ before_validation_on_update :before_validation_on_update_if_with_string_condition,
+ :if => 'attribute_63 == "before_validation_on_update_if_with_string_condition"'
+ before_validation_on_update :before_validation_on_update_unless_with_string_condition,
+ :unless => 'attribute_64 == "before_validation_on_update_unless_with_string_condition"'
+
+ def before_validation_on_update_if_with_string_condition
+ self.attribute_63 = 'attribute_63'
+ end
+
+ def before_validation_on_update_unless_with_string_condition
+ self.attribute_64 = 'attribute_64'
+ end
+
+ after_validation_on_update :after_validation_on_update_if_with_string_condition,
+ :if => 'attribute_65 == "after_validation_on_update_if_with_string_condition"'
+ after_validation_on_update :after_validation_on_update_unless_with_string_condition,
+ :unless => 'attribute_66 == "after_validation_on_update_unless_with_string_condition"'
+
+ def after_validation_on_update_if_with_string_condition
+ self.attribute_65 = 'attribute_65'
+ end
+
+ def after_validation_on_update_unless_with_string_condition
+ self.attribute_66 = 'attribute_66'
+ end
+
+ after_initialize :after_initialize_if_with_string_condition,
+ :if => 'attribute_67 == "after_initialize_if_with_string_condition"'
+ after_initialize :after_initialize_unless_with_string_condition,
+ :unless => 'attribute_68 == "after_initialize_unless_with_string_condition"'
+
+ def after_initialize
+ end
+
+ def after_initialize_if_with_string_condition
+ self.attribute_67 = 'attribute_67'
+ end
+
+ def after_initialize_unless_with_string_condition
+ self.attribute_68 = 'attribute_68'
+ end
+
+ after_find :after_find_if_with_string_condition,
+ :if => 'name == "after_find_if_with_string_condition"'
+ after_find :after_find_unless_with_string_condition,
+ :unless => 'name == "after_find_unless_with_string_condition"'
+
+ def after_find
+ end
+
+ def after_find_if_with_string_condition
+ self.attribute_69 = 'attribute_69'
+ end
+
+ def after_find_unless_with_string_condition
+ self.attribute_70 = 'attribute_70'
+ end
+
+ validate :validate_if_with_string_condition,
+ :if => 'attribute_71 == "validate_if_with_string_condition"'
+ validate :validate_unless_with_string_condition,
+ :unless => 'attribute_72 == "validate_unless_with_string_condition"'
+
+ def validate_if_with_string_condition
+ self.attribute_71 = 'attribute_71'
+ end
+
+ def validate_unless_with_string_condition
+ self.attribute_72 = 'attribute_72'
+ end
+
+ validate_on_create :validate_on_create_if_with_string_condition,
+ :if => 'attribute_73 == "validate_on_create_if_with_string_condition"'
+ validate_on_create :validate_on_create_unless_with_string_condition,
+ :unless => 'attribute_74 == "validate_on_create_unless_with_string_condition"'
+
+ def validate_on_create_if_with_string_condition
+ self.attribute_73 = 'attribute_73'
+ end
+
+ def validate_on_create_unless_with_string_condition
+ self.attribute_74 = 'attribute_74'
+ end
+
+ validate_on_update :validate_on_update_if_with_string_condition,
+ :if => 'attribute_75 == "validate_on_update_if_with_string_condition"'
+ validate_on_update :validate_on_update_unless_with_string_condition,
+ :unless => 'attribute_76 == "validate_on_update_unless_with_string_condition"'
+
+ def validate_on_update_if_with_string_condition
+ self.attribute_75 = 'attribute_75'
+ end
+
+ def validate_on_update_unless_with_string_condition
+ self.attribute_76 = 'attribute_76'
+ end
+
+ before_create :before_create_if_with_symbol_condition,
+ :if => :before_create_if_with_symbol_condition?
+ before_create :before_create_unless_with_symbol_condition,
+ :unless => :before_create_unless_with_symbol_condition?
+
+ def before_create_if_with_symbol_condition
+ self.attribute_77 = 'attribute_77'
+ end
+
+ def before_create_if_with_symbol_condition?
+ attribute_77 == 'before_create_if_with_symbol_condition'
+ end
+
+ def before_create_unless_with_symbol_condition
+ self.attribute_78 = 'attribute_78'
+ end
+
+ def before_create_unless_with_symbol_condition?
+ attribute_78 == 'before_create_unless_with_symbol_condition'
+ end
+
+ after_create :after_create_if_with_symbol_condition,
+ :if => :after_create_if_with_symbol_condition?
+ after_create :after_create_unless_with_symbol_condition,
+ :unless => :after_create_unless_with_symbol_condition?
+
+ def after_create_if_with_symbol_condition
+ self.attribute_79 = 'attribute_79'
+ end
+
+ def after_create_if_with_symbol_condition?
+ attribute_79 == 'after_create_if_with_symbol_condition'
+ end
+
+ def after_create_unless_with_symbol_condition
+ self.attribute_80 = 'attribute_80'
+ end
+
+ def after_create_unless_with_symbol_condition?
+ attribute_80 == 'after_create_unless_with_symbol_condition'
+ end
+
+ before_save :before_save_if_with_symbol_condition,
+ :if => :before_save_if_with_symbol_condition?
+ before_save :before_save_unless_with_symbol_condition,
+ :unless => :before_save_unless_with_symbol_condition?
+
+ def before_save_if_with_symbol_condition
+ self.attribute_81 = 'attribute_81'
+ end
+
+ def before_save_if_with_symbol_condition?
+ attribute_81 == 'before_save_if_with_symbol_condition'
+ end
+
+ def before_save_unless_with_symbol_condition
+ self.attribute_82 = 'attribute_82'
+ end
+
+ def before_save_unless_with_symbol_condition?
+ attribute_82 == 'before_save_unless_with_symbol_condition'
+ end
+
+ after_save :after_save_if_with_symbol_condition,
+ :if => :after_save_if_with_symbol_condition?
+ after_save :after_save_unless_with_symbol_condition,
+ :unless => :after_save_unless_with_symbol_condition?
+
+ def after_save_if_with_symbol_condition
+ self.attribute_83 = 'attribute_83'
+ end
+
+ def after_save_if_with_symbol_condition?
+ attribute_83 == 'after_save_if_with_symbol_condition'
+ end
+
+ def after_save_unless_with_symbol_condition
+ self.attribute_84 = 'attribute_84'
+ end
+
+ def after_save_unless_with_symbol_condition?
+ attribute_84 == 'after_save_unless_with_symbol_condition'
+ end
+
+ before_destroy :before_destroy_if_with_symbol_condition,
+ :if => :before_destroy_if_with_symbol_condition?
+ before_destroy :before_destroy_unless_with_symbol_condition,
+ :unless => :before_destroy_unless_with_symbol_condition?
+
+ def before_destroy_if_with_symbol_condition
+ self.attribute_85 = 'attribute_85'
+ end
+
+ def before_destroy_if_with_symbol_condition?
+ attribute_85 == 'before_destroy_if_with_symbol_condition'
+ end
+
+ def before_destroy_unless_with_symbol_condition
+ self.attribute_86 = 'attribute_86'
+ end
+
+ def before_destroy_unless_with_symbol_condition?
+ attribute_86 == 'before_destroy_unless_with_symbol_condition'
+ end
+
+ after_destroy :after_destroy_if_with_symbol_condition,
+ :if => :after_destroy_if_with_symbol_condition?
+ after_destroy :after_destroy_unless_with_symbol_condition,
+ :unless => :after_destroy_unless_with_symbol_condition?
+
+ def after_destroy_if_with_symbol_condition
+ self.attribute_87 = 'attribute_87'
+ end
+
+ def after_destroy_if_with_symbol_condition?
+ attribute_87 == 'after_destroy_if_with_symbol_condition'
+ end
+
+ def after_destroy_unless_with_symbol_condition
+ self.attribute_88 = 'attribute_88'
+ end
+
+ def after_destroy_unless_with_symbol_condition?
+ attribute_88 == 'after_destroy_unless_with_symbol_condition'
+ end
+
+ before_update :before_update_if_with_symbol_condition,
+ :if => :before_update_if_with_symbol_condition?
+ before_update :before_update_unless_with_symbol_condition,
+ :unless => :before_update_unless_with_symbol_condition?
+
+ def before_update_if_with_symbol_condition
+ self.attribute_89 = 'attribute_89'
+ end
+
+ def before_update_if_with_symbol_condition?
+ attribute_89 == 'before_update_if_with_symbol_condition'
+ end
+
+ def before_update_unless_with_symbol_condition
+ self.attribute_90 = 'attribute_90'
+ end
+
+ def before_update_unless_with_symbol_condition?
+ attribute_90 == 'before_update_unless_with_symbol_condition'
+ end
+
+ after_update :after_update_if_with_symbol_condition,
+ :if => :after_update_if_with_symbol_condition?
+ after_update :after_update_unless_with_symbol_condition,
+ :unless => :after_update_unless_with_symbol_condition?
+
+ def after_update_if_with_symbol_condition
+ self.attribute_91 = 'attribute_91'
+ end
+
+ def after_update_if_with_symbol_condition?
+ attribute_91 == 'after_update_if_with_symbol_condition'
+ end
+
+ def after_update_unless_with_symbol_condition
+ self.attribute_92 = 'attribute_92'
+ end
+
+ def after_update_unless_with_symbol_condition?
+ attribute_92 == 'after_update_unless_with_symbol_condition'
+ end
+
+ before_validation :before_validation_if_with_symbol_condition,
+ :if => :before_validation_if_with_symbol_condition?
+ before_validation :before_validation_unless_with_symbol_condition,
+ :unless => :before_validation_unless_with_symbol_condition?
+
+ def before_validation_if_with_symbol_condition
+ self.attribute_93 = 'attribute_93'
+ end
+
+ def before_validation_if_with_symbol_condition?
+ attribute_93 == 'before_validation_if_with_symbol_condition'
+ end
+
+ def before_validation_unless_with_symbol_condition
+ self.attribute_94 = 'attribute_94'
+ end
+
+ def before_validation_unless_with_symbol_condition?
+ attribute_94 == 'before_validation_unless_with_symbol_condition'
+ end
+
+ after_validation :after_validation_if_with_symbol_condition,
+ :if => :after_validation_if_with_symbol_condition?
+ after_validation :after_validation_unless_with_symbol_condition,
+ :unless => :after_validation_unless_with_symbol_condition?
+
+ def after_validation_if_with_symbol_condition
+ self.attribute_95 = 'attribute_95'
+ end
+
+ def after_validation_if_with_symbol_condition?
+ attribute_95 == 'after_validation_if_with_symbol_condition'
+ end
+
+ def after_validation_unless_with_symbol_condition
+ self.attribute_96 = 'attribute_96'
+ end
+
+ def after_validation_unless_with_symbol_condition?
+ attribute_96 == 'after_validation_unless_with_symbol_condition'
+ end
+
+ before_validation_on_create :before_validation_on_create_if_with_symbol_condition,
+ :if => :before_validation_on_create_if_with_symbol_condition?
+ before_validation_on_create :before_validation_on_create_unless_with_symbol_condition,
+ :unless => :before_validation_on_create_unless_with_symbol_condition?
+
+ def before_validation_on_create_if_with_symbol_condition
+ self.attribute_97 = 'attribute_97'
+ end
+
+ def before_validation_on_create_if_with_symbol_condition?
+ attribute_97 == 'before_validation_on_create_if_with_symbol_condition'
+ end
+
+ def before_validation_on_create_unless_with_symbol_condition
+ self.attribute_98 = 'attribute_98'
+ end
+
+ def before_validation_on_create_unless_with_symbol_condition?
+ attribute_98 == 'before_validation_on_create_unless_with_symbol_condition'
+ end
+
+ after_validation_on_create :after_validation_on_create_if_with_symbol_condition,
+ :if => :after_validation_on_create_if_with_symbol_condition?
+ after_validation_on_create :after_validation_on_create_unless_with_symbol_condition,
+ :unless => :after_validation_on_create_unless_with_symbol_condition?
+
+ def after_validation_on_create_if_with_symbol_condition
+ self.attribute_99 = 'attribute_99'
+ end
+
+ def after_validation_on_create_if_with_symbol_condition?
+ attribute_99 == 'after_validation_on_create_if_with_symbol_condition'
+ end
+
+ def after_validation_on_create_unless_with_symbol_condition
+ self.attribute_100 = 'attribute_100'
+ end
+
+ def after_validation_on_create_unless_with_symbol_condition?
+ attribute_100 == 'after_validation_on_create_unless_with_symbol_condition'
+ end
+
+ before_validation_on_update :before_validation_on_update_if_with_symbol_condition,
+ :if => :before_validation_on_update_if_with_symbol_condition?
+ before_validation_on_update :before_validation_on_update_unless_with_symbol_condition,
+ :unless => :before_validation_on_update_unless_with_symbol_condition?
+
+ def before_validation_on_update_if_with_symbol_condition
+ self.attribute_101 = 'attribute_101'
+ end
+
+ def before_validation_on_update_if_with_symbol_condition?
+ attribute_101 == 'before_validation_on_update_if_with_symbol_condition'
+ end
+
+ def before_validation_on_update_unless_with_symbol_condition
+ self.attribute_102 = 'attribute_102'
+ end
+
+ def before_validation_on_update_unless_with_symbol_condition?
+ attribute_102 == 'before_validation_on_update_unless_with_symbol_condition'
+ end
+
+ after_validation_on_update :after_validation_on_update_if_with_symbol_condition,
+ :if => :after_validation_on_update_if_with_symbol_condition?
+ after_validation_on_update :after_validation_on_update_unless_with_symbol_condition,
+ :unless => :after_validation_on_update_unless_with_symbol_condition?
+
+ def after_validation_on_update_if_with_symbol_condition
+ self.attribute_103 = 'attribute_103'
+ end
+
+ def after_validation_on_update_if_with_symbol_condition?
+ attribute_103 == 'after_validation_on_update_if_with_symbol_condition'
+ end
+
+ def after_validation_on_update_unless_with_symbol_condition
+ self.attribute_104 = 'attribute_104'
+ end
+
+ def after_validation_on_update_unless_with_symbol_condition?
+ attribute_104 == 'after_validation_on_update_unless_with_symbol_condition'
+ end
+
+ after_initialize :after_initialize_if_with_symbol_condition,
+ :if => :after_initialize_if_with_symbol_condition?
+ after_initialize :after_initialize_unless_with_symbol_condition,
+ :unless => :after_initialize_unless_with_symbol_condition?
+
+ def after_initialize
+ end
+
+ def after_initialize_if_with_symbol_condition
+ self.attribute_105 = 'attribute_105'
+ end
+
+ def after_initialize_if_with_symbol_condition?
+ attribute_105 == 'after_initialize_if_with_symbol_condition'
+ end
+
+ def after_initialize_unless_with_symbol_condition
+ self.attribute_106 = 'attribute_106'
+ end
+
+ def after_initialize_unless_with_symbol_condition?
+ attribute_106 == 'after_initialize_unless_with_symbol_condition'
+ end
+
+ after_find :after_find_if_with_symbol_condition,
+ :if => :after_find_if_with_symbol_condition?
+ after_find :after_find_unless_with_symbol_condition,
+ :unless => :after_find_unless_with_symbol_condition?
+
+ def after_find
+ end
+
+ def after_find_if_with_symbol_condition
+ self.attribute_107 = 'attribute_107'
+ end
+
+ def after_find_if_with_symbol_condition?
+ name == 'after_find_if_with_symbol_condition'
+ end
+
+ def after_find_unless_with_symbol_condition
+ self.attribute_108 = 'attribute_108'
+ end
+
+ def after_find_unless_with_symbol_condition?
+ name == 'after_find_unless_with_symbol_condition'
+ end
+
+ validate :validate_if_with_symbol_condition,
+ :if => :validate_if_with_symbol_condition?
+ validate :validate_unless_with_symbol_condition,
+ :unless => :validate_unless_with_symbol_condition?
+
+ def validate_if_with_symbol_condition
+ self.attribute_109 = 'attribute_109'
+ end
+
+ def validate_if_with_symbol_condition?
+ attribute_109 == 'validate_if_with_symbol_condition'
+ end
+
+ def validate_unless_with_symbol_condition
+ self.attribute_110 = 'attribute_110'
+ end
+
+ def validate_unless_with_symbol_condition?
+ attribute_110 == 'validate_unless_with_symbol_condition'
+ end
+
+ validate_on_create :validate_on_create_if_with_symbol_condition,
+ :if => :validate_on_create_if_with_symbol_condition?
+ validate_on_create :validate_on_create_unless_with_symbol_condition,
+ :unless => :validate_on_create_unless_with_symbol_condition?
+
+ def validate_on_create_if_with_symbol_condition
+ self.attribute_111 = 'attribute_111'
+ end
+
+ def validate_on_create_if_with_symbol_condition?
+ attribute_111 == 'validate_on_create_if_with_symbol_condition'
+ end
+
+ def validate_on_create_unless_with_symbol_condition
+ self.attribute_112 = 'attribute_112'
+ end
+
+ def validate_on_create_unless_with_symbol_condition?
+ attribute_112 == 'validate_on_create_unless_with_symbol_condition'
+ end
+
+ validate_on_update :validate_on_update_if_with_symbol_condition,
+ :if => :validate_on_update_if_with_symbol_condition?
+ validate_on_update :validate_on_update_unless_with_symbol_condition,
+ :unless => :validate_on_update_unless_with_symbol_condition?
+
+ def validate_on_update_if_with_symbol_condition
+ self.attribute_113 = 'attribute_113'
+ end
+
+ def validate_on_update_if_with_symbol_condition?
+ attribute_113 == 'validate_on_update_if_with_symbol_condition'
+ end
+
+ def validate_on_update_unless_with_symbol_condition
+ self.attribute_114 = 'attribute_114'
+ end
+
+ def validate_on_update_unless_with_symbol_condition?
+ attribute_114 == 'validate_on_update_unless_with_symbol_condition'
+ end
+
+end
View
5 test/schema.rb
@@ -0,0 +1,5 @@
+ActiveRecord::Schema.define(:version => 1) do
+ create_table :companies, :force => true do |t|
+ t.column :name, :string
+ end
+end
View
9 test/test_helper.rb
@@ -0,0 +1,9 @@
+require 'rubygems'
+require 'test/unit'
+require 'active_record'
+require 'active_record/fixtures'
+require File.join(File.dirname(__FILE__), '..', 'init')
+
+config = YAML::load File.read(File.join(File.dirname(__FILE__), 'database.yml'))
+ActiveRecord::Base.establish_connection config['test']
+load File.join(File.dirname(__FILE__), 'schema.rb')
View
1,440 test/when_test.rb
@@ -1,8 +1,1440 @@
-require 'test/unit'
+require File.join(File.dirname(__FILE__), 'test_helper')
+require File.join(File.dirname(__FILE__), 'fixtures', 'company')
class WhenTest < Test::Unit::TestCase
- # Replace this with your real tests.
- def test_this_plugin
- flunk
+
+ def test_should_set_its_attribute_1_if_its_before_create_if_with_proc_condition_when_sent_save_on_initial_creation
+ company = Company.new :attribute_1 => 'before_create_if_with_proc_condition'
+
+ assert company.save_without_validation
+ assert_equal 'attribute_1', company.attribute_1
+
+ company = Company.new
+
+ assert company.save_without_validation
+ assert_nil company.attribute_1
+ end
+
+ def test_should_set_its_attribute_2_unless_its_before_create_unless_with_proc_condition_when_sent_save_on_initial_creation
+ company = Company.new :attribute_2 => 'before_create_unless_with_proc_condition'
+
+ assert company.save_without_validation
+ assert_equal 'before_create_unless_with_proc_condition', company.attribute_2
+
+ company = Company.new
+
+ assert company.save_without_validation
+ assert_equal 'attribute_2', company.attribute_2
+ end
+
+ def test_should_set_its_attribute_3_if_its_after_create_if_with_proc_condition_when_sent_save_on_initial_creation
+ company = Company.new :attribute_3 => 'after_create_if_with_proc_condition'
+
+ assert company.save_without_validation
+ assert_equal 'attribute_3', company.attribute_3
+
+ company = Company.new
+
+ assert company.save_without_validation
+ assert_nil company.attribute_3
+ end
+
+ def test_should_set_its_attribute_4_unless_its_after_create_unless_with_proc_condition_when_sent_save_on_initial_creation
+ company = Company.new :attribute_4 => 'after_create_unless_with_proc_condition'
+
+ assert company.save_without_validation
+ assert_equal 'after_create_unless_with_proc_condition', company.attribute_4
+
+ company = Company.new
+
+ assert company.save_without_validation
+ assert_equal 'attribute_4', company.attribute_4
+ end
+
+ def test_should_set_its_attribute_5_if_its_before_save_if_with_proc_condition_when_sent_save
+ company = Company.new :attribute_5 => 'before_save_if_with_proc_condition'
+
+ assert company.save_without_validation
+ assert_equal 'attribute_5', company.attribute_5
+
+ company = Company.new
+
+ assert company.save_without_validation
+ assert_nil company.attribute_5
+
+ company.attribute_5 = 'before_save_if_with_proc_condition'
+
+ assert company.save_without_validation
+ assert_equal 'attribute_5', company.attribute_5
+ end
+
+ def test_should_set_its_attribute_6_unless_its_before_save_unless_with_proc_condition_when_sent_save
+ company = Company.new :attribute_6 => 'before_save_unless_with_proc_condition'
+
+ assert company.save_without_validation
+ assert_equal 'before_save_unless_with_proc_condition', company.attribute_6
+ assert company.save_without_validation
+ assert_equal 'before_save_unless_with_proc_condition', company.attribute_6
+
+ company = Company.new
+
+ assert company.save_without_validation
+ assert_equal 'attribute_6', company.attribute_6
+
+ company.attribute_6 = ''
+
+ assert company.save_without_validation
+ assert_equal 'attribute_6', company.attribute_6
+ end
+
+ def test_should_set_its_attribute_7_if_its_after_save_if_with_proc_condition_when_sent_save
+ company = Company.new :attribute_7 => 'after_save_if_with_proc_condition'
+
+ assert company.save_without_validation
+ assert_equal 'attribute_7', company.attribute_7
+
+ company = Company.new
+
+ assert company.save_without_validation
+ assert_nil company.attribute_7
+
+ company.attribute_7 = 'after_save_if_with_proc_condition'
+
+ assert company.save_without_validation
+ assert_equal 'attribute_7', company.attribute_7
+ end
+
+ def test_should_set_its_attribute_8_unless_its_after_save_unless_with_proc_condition_when_sent_save
+ company = Company.new :attribute_8 => 'after_save_unless_with_proc_condition'
+
+ assert company.save_without_validation
+ assert_equal 'after_save_unless_with_proc_condition', company.attribute_8
+ assert company.save_without_validation
+ assert_equal 'after_save_unless_with_proc_condition', company.attribute_8
+
+ company = Company.new
+
+ assert company.save_without_validation
+ assert_equal 'attribute_8', company.attribute_8
+
+ company.attribute_8 = ''
+
+ assert company.save_without_validation
+ assert_equal 'attribute_8', company.attribute_8
+ end
+
+ def test_should_set_its_attribute_9_if_its_before_destroy_if_with_proc_condition_when_sent_destroy
+ company = Company.new
+
+ assert company.save_without_validation
+ assert_nil company.attribute_9
+
+ company.attribute_9 = 'before_destroy_if_with_proc_condition'
+ assert company.destroy
+ assert_equal 'attribute_9', company.attribute_9
+
+ company = Company.new
+
+ assert company.save_without_validation
+ assert company.destroy
+ assert_nil company.attribute_9
+ end
+
+ def test_should_set_its_attribute_10_unless_its_before_destroy_unless_with_proc_condition_when_sent_destroy
+ company = Company.new :attribute_10 => 'before_destroy_unless_with_proc_condition'
+
+ assert company.save_without_validation
+ assert company.destroy
+ assert_equal 'before_destroy_unless_with_proc_condition', company.attribute_10
+
+ company = Company.new
+
+ assert company.save_without_validation
+ assert_nil company.attribute_10
+ assert company.destroy
+ assert_equal 'attribute_10', company.attribute_10
+ end
+
+ def test_should_set_its_attribute_11_if_its_after_destroy_if_with_proc_condition_when_sent_destroy
+ company = Company.new
+
+ assert company.save_without_validation
+ assert_nil company.attribute_11
+
+ company.attribute_11 = 'after_destroy_if_with_proc_condition'
+ assert company.destroy
+ assert_equal 'attribute_11', company.attribute_11
+
+ company = Company.new
+
+ assert company.save_without_validation
+ assert company.destroy
+ assert_nil company.attribute_11
+ end
+
+ def test_should_set_its_attribute_12_unless_its_after_destroy_unless_with_proc_condition_when_sent_destroy
+ company = Company.new :attribute_12 => 'after_destroy_unless_with_proc_condition'
+
+ assert company.save_without_validation
+ assert company.destroy
+ assert_equal 'after_destroy_unless_with_proc_condition', company.attribute_12
+
+ company = Company.new
+
+ assert company.save_without_validation
+ assert_nil company.attribute_12
+ assert company.destroy
+ assert_equal 'attribute_12', company.attribute_12
+ end
+
+ def test_should_set_its_attribute_13_if_its_before_update_if_with_proc_condition_when_sent_save_on_an_update
+ company = Company.new
+
+ assert company.save_without_validation
+ assert_nil company.attribute_13
+
+ company.attribute_13 = 'before_update_if_with_proc_condition'
+ assert company.save_without_validation
+ assert_equal 'attribute_13', company.attribute_13
+
+ company = Company.new
+
+ assert company.save_without_validation
+ assert company.save_without_validation
+ assert_nil company.attribute_13
+ end
+
+ def test_should_set_its_attribute_14_unless_its_before_update_unless_with_proc_condition_when_sent_save_on_an_update
+ company = Company.new :attribute_14 => 'before_update_unless_with_proc_condition'
+
+ assert company.save_without_validation
+ assert company.save_without_validation
+ assert_equal 'before_update_unless_with_proc_condition', company.attribute_14
+
+ company = Company.new
+
+ assert company.save_without_validation
+ assert_nil company.attribute_14
+ assert company.save_without_validation
+ assert_equal 'attribute_14', company.attribute_14
+ end
+
+ def test_should_set_its_attribute_15_if_its_after_update_if_with_proc_condition_when_sent_save_on_an_update
+ company = Company.new
+
+ assert company.save_without_validation
+ assert_nil company.attribute_15
+
+ company.attribute_15 = 'after_update_if_with_proc_condition'
+ assert company.save_without_validation
+ assert_equal 'attribute_15', company.attribute_15
+
+ company = Company.new
+
+ assert company.save_without_validation
+ assert company.save_without_validation
+ assert_nil company.attribute_15
+ end
+
+ def test_should_set_its_attribute_16_unless_its_after_update_unless_with_proc_condition_when_sent_on_an_update
+ company = Company.new :attribute_16 => 'after_update_unless_with_proc_condition'
+
+ assert company.save_without_validation
+ assert company.save_without_validation
+ assert_equal 'after_update_unless_with_proc_condition', company.attribute_16
+
+ company = Company.new
+
+ assert company.save_without_validation
+ assert_nil company.attribute_16
+ assert company.save_without_validation
+ assert_equal 'attribute_16', company.attribute_16
+ end
+
+ def test_should_set_its_attribute_17_if_its_before_validation_if_with_proc_condition_when_sent_valid?
+ company = Company.new :attribute_17 => 'before_validation_if_with_proc_condition'
+ company.valid?
+ assert_equal 'attribute_17', company.attribute_17
+
+ company = Company.new
+ company.valid?
+ assert_nil company.attribute_17
+ end
+
+ def test_should_set_its_attribute_18_unless_its_before_validation_unless_with_proc_condition_when_sent_valid?
+ company = Company.new :attribute_18 => 'before_validation_unless_with_proc_condition'
+ company.valid?
+ assert_equal 'before_validation_unless_with_proc_condition', company.attribute_18
+
+ company = Company.new
+ company.valid?
+ assert_equal 'attribute_18', company.attribute_18
+ end
+
+ def test_should_set_its_attribute_19_if_its_after_validation_if_with_proc_condition_when_sent_valid?
+ company = Company.new :attribute_19 => 'after_validation_if_with_proc_condition'
+ company.valid?
+ assert_equal 'attribute_19', company.attribute_19
+
+ company = Company.new
+ company.valid?
+ assert_nil company.attribute_19
+ end
+
+ def test_should_set_its_attribute_20_unless_its_after_validation_unless_with_proc_condition_when_sent_valid?
+ company = Company.new :attribute_20 => 'after_validation_unless_with_proc_condition'
+ company.valid?
+ assert_equal 'after_validation_unless_with_proc_condition', company.attribute_20
+
+ company = Company.new
+ company.valid?
+ assert_equal 'attribute_20', company.attribute_20
+ end
+
+ def test_should_set_its_attribute_21_if_its_before_validation_on_create_if_with_proc_condition_when_sent_valid?
+ company = Company.new :attribute_21 => 'before_validation_on_create_if_with_proc_condition'
+ company.valid?
+ assert_equal 'attribute_21', company.attribute_21
+
+ company = Company.new
+ company.valid?
+ assert_nil company.attribute_21
+ end
+
+ def test_should_set_its_attribute_22_unless_its_before_validation_on_create_unless_with_proc_condition_when_sent_valid?
+ company = Company.new :attribute_22 => 'before_validation_on_create_unless_with_proc_condition'
+ company.valid?
+ assert_equal 'before_validation_on_create_unless_with_proc_condition', company.attribute_22
+
+ company = Company.new
+ company.valid?
+ assert_equal 'attribute_22', company.attribute_22
+ end
+
+ def test_should_set_its_attribute_23_if_its_after_validation_on_create_if_with_proc_condition_when_sent_valid?
+ company = Company.new :attribute_23 => 'after_validation_on_create_if_with_proc_condition'
+ company.valid?
+ assert_equal 'attribute_23', company.attribute_23
+
+ company = Company.new
+ company.valid?
+ assert_nil company.attribute_23
+ end
+
+ def test_should_set_its_attribute_24_unless_its_after_validation_on_create_unless_with_proc_condition_when_sent_valid?
+ company = Company.new :attribute_24 => 'after_validation_on_create_unless_with_proc_condition'
+ company.valid?
+ assert_equal 'after_validation_on_create_unless_with_proc_condition', company.attribute_24
+
+ company = Company.new
+ company.valid?
+ assert_equal 'attribute_24', company.attribute_24
+ end
+
+ def test_should_set_its_attribute_25_if_its_before_validation_on_update_if_with_proc_condition_when_sent_valid?
+ company = Company.new :attribute_25 => 'before_validation_on_update_if_with_proc_condition'
+ assert company.save_without_validation
+ company.valid?
+ assert_equal 'attribute_25', company.attribute_25
+
+ company = Company.new
+ assert company.save_without_validation
+ company.valid?
+ assert_nil company.attribute_25
+ end
+
+ def test_should_set_its_attribute_26_unless_its_before_validation_on_update_unless_with_proc_condition_when_sent_valid?
+ company = Company.new :attribute_26 => 'before_validation_on_update_unless_with_proc_condition'
+ assert company.save_without_validation
+ company.valid?
+ assert_equal 'before_validation_on_update_unless_with_proc_condition', company.attribute_26
+
+ company = Company.new
+ assert company.save_without_validation
+ company.valid?
+ assert_equal 'attribute_26', company.attribute_26
+ end
+
+ def test_should_set_its_attribute_27_if_its_after_validation_on_update_if_with_proc_condition_when_sent_valid?
+ company = Company.new :attribute_27 => 'after_validation_on_update_if_with_proc_condition'
+ assert company.save_without_validation
+ company.valid?
+ assert_equal 'attribute_27', company.attribute_27
+
+ company = Company.new
+ assert company.save_without_validation
+ company.valid?
+ assert_nil company.attribute_27
+ end
+
+ def test_should_set_its_attribute_28_unless_its_after_validation_on_update_unless_with_proc_condition_when_sent_valid?
+ company = Company.new :attribute_28 => 'after_validation_on_update_unless_with_proc_condition'
+ assert company.save_without_validation
+ company.valid?
+ assert_equal 'after_validation_on_update_unless_with_proc_condition', company.attribute_28
+
+ company = Company.new
+ assert company.save_without_validation
+ company.valid?
+ assert_equal 'attribute_28', company.attribute_28
+ end
+
+ def test_should_set_its_attribute_29_if_its_after_initialize_if_with_proc_condition_when_sent_new
+ company = Company.new :attribute_29 => 'after_initialize_if_with_proc_condition'
+ assert_equal 'attribute_29', company.attribute_29
+
+ company = Company.new
+ assert_nil company.attribute_29
+ end
+
+ def test_should_set_its_attribute_30_unless_its_after_initialize_unless_with_proc_condition_when_sent_new
+ company = Company.new :attribute_30 => 'after_initialize_unless_with_proc_condition'
+ assert_equal 'after_initialize_unless_with_proc_condition', company.attribute_30
+
+ company = Company.new
+ assert_equal 'attribute_30', company.attribute_30
+ end
+
+ def test_should_set_its_attribute_31_if_its_name_is_after_find_if_with_proc_condition_when_sent_find
+ company = Company.new :name => 'after_find_if_with_proc_condition'
+ assert company.save
+
+ company = Company.find company.id
+ assert_equal 'attribute_31', company.attribute_31
+ end
+
+ def test_should_set_its_attribute_32_unless_its_name_is_after_find_unless_with_proc_condition_when_sent_find
+ company = Company.new :name => 'after_find_unless_with_proc_condition'
+ assert company.save
+
+ company = Company.find company.id
+ assert_nil company.attribute_32
+
+ company = Company.new :name => 'name'
+ assert company.save
+
+ company = Company.find company.id
+ assert_equal 'attribute_32', company.attribute_32
+ end
+
+ def test_should_set_its_attribute_33_if_its_validate_if_with_proc_condition_when_sent_valid?
+ company = Company.new :attribute_33 => 'validate_if_with_proc_condition'
+ company.valid?
+ assert_equal 'attribute_33', company.attribute_33
+
+ company = Company.new
+ company.valid?
+ assert_nil company.attribute_33
+ end
+
+ def test_should_set_its_attribute_34_unless_its_validate_unless_with_proc_condition_when_sent_valid?
+ company = Company.new :attribute_34 => 'validate_unless_with_proc_condition'
+ company.valid?
+ assert_equal 'validate_unless_with_proc_condition', company.attribute_34
+
+ company = Company.new
+ company.valid?
+ assert_equal 'attribute_34', company.attribute_34
+ end
+
+ def test_should_set_its_attribute_35_if_its_validate_on_create_if_with_proc_condition_when_sent_valid?
+ company = Company.new :attribute_35 => 'validate_on_create_if_with_proc_condition'
+ company.valid?
+ assert_equal 'attribute_35', company.attribute_35
+
+ company = Company.new
+ company.valid?
+ assert_nil company.attribute_35
+ end
+
+ def test_should_set_its_attribute_36_unless_its_validate_on_create_unless_with_proc_condition_when_sent_valid?
+ company = Company.new :attribute_36 => 'validate_on_create_unless_with_proc_condition'
+ company.valid?
+ assert_equal 'validate_on_create_unless_with_proc_condition', company.attribute_36
+
+ company = Company.new
+ company.valid?
+ assert_equal 'attribute_36', company.attribute_36
+ end
+
+ def test_should_set_its_attribute_37_if_its_validate_on_update_if_with_proc_condition_when_sent_valid?
+ company = Company.new :attribute_37 => 'validate_on_update_if_with_proc_condition'
+ assert company.save_without_validation
+ company.valid?
+ assert_equal 'attribute_37', company.attribute_37
+
+ company = Company.new
+ assert company.save_without_validation
+ company.valid?
+ assert_nil company.attribute_37
+ end
+
+ def test_should_set_its_attribute_38_unless_its_validate_on_update_unless_with_proc_condition_when_sent_valid?
+ company = Company.new :attribute_38 => 'validate_on_update_unless_with_proc_condition'
+ assert company.save_without_validation
+ company.valid?
+ assert_equal 'validate_on_update_unless_with_proc_condition', company.attribute_38
+
+ company = Company.new
+ assert company.save_without_validation
+ company.valid?
+ assert_equal 'attribute_38', company.attribute_38
+ end
+
+ def test_should_set_its_attribute_39_if_its_before_create_if_with_string_condition_when_sent_save_on_initial_creation
+ company = Company.new :attribute_39 => 'before_create_if_with_string_condition'
+
+ assert company.save_without_validation
+ assert_equal 'attribute_39', company.attribute_39
+
+ company = Company.new
+
+ assert company.save_without_validation
+ assert_nil company.attribute_39
+ end
+
+ def test_should_set_its_attribute_40_unless_its_before_create_unless_with_string_condition_when_sent_save_on_initial_creation
+ company = Company.new :attribute_40 => 'before_create_unless_with_string_condition'
+
+ assert company.save_without_validation
+ assert_equal 'before_create_unless_with_string_condition', company.attribute_40
+
+ company = Company.new
+
+ assert company.save_without_validation
+ assert_equal 'attribute_40', company.attribute_40
+ end
+
+ def test_should_set_its_attribute_41_if_its_after_create_if_with_string_condition_when_sent_save_on_initial_creation
+ company = Company.new :attribute_41 => 'after_create_if_with_string_condition'
+
+ assert company.save_without_validation
+ assert_equal 'attribute_41', company.attribute_41
+
+ company = Company.new
+
+ assert company.save_without_validation
+ assert_nil company.attribute_41
+ end
+
+ def test_should_set_its_attribute_42_unless_its_after_create_unless_with_string_condition_when_sent_save_on_initial_creation
+ company = Company.new :attribute_42 => 'after_create_unless_with_string_condition'
+
+ assert company.save_without_validation
+ assert_equal 'after_create_unless_with_string_condition', company.attribute_42
+
+ company = Company.new
+
+ assert company.save_without_validation
+ assert_equal 'attribute_42', company.attribute_42
+ end
+
+ def test_should_set_its_attribute_43_if_its_before_save_if_with_string_condition_when_sent_save
+ company = Company.new :attribute_43 => 'before_save_if_with_string_condition'
+
+ assert company.save_without_validation
+ assert_equal 'attribute_43', company.attribute_43
+
+ company = Company.new
+
+ assert company.save_without_validation
+ assert_nil company.attribute_43
+
+ company.attribute_43 = 'before_save_if_with_string_condition'
+
+ assert company.save_without_validation
+ assert_equal 'attribute_43', company.attribute_43
+ end
+
+ def test_should_set_its_attribute_44_unless_its_before_save_unless_with_string_condition_when_sent_save
+ company = Company.new :attribute_44 => 'before_save_unless_with_string_condition'
+
+ assert company.save_without_validation
+ assert_equal 'before_save_unless_with_string_condition', company.attribute_44
+ assert company.save_without_validation
+ assert_equal 'before_save_unless_with_string_condition', company.attribute_44
+
+ company = Company.new
+
+ assert company.save_without_validation
+ assert_equal 'attribute_44', company.attribute_44
+
+ company.attribute_44 = ''
+
+ assert company.save_without_validation
+ assert_equal 'attribute_44', company.attribute_44
+ end
+
+ def test_should_set_its_attribute_45_if_its_after_save_if_with_string_condition_when_sent_save
+ company = Company.new :attribute_45 => 'after_save_if_with_string_condition'
+
+ assert company.save_without_validation
+ assert_equal 'attribute_45', company.attribute_45
+
+ company = Company.new
+
+ assert company.save_without_validation
+ assert_nil company.attribute_45
+
+ company.attribute_45 = 'after_save_if_with_string_condition'
+
+ assert company.save_without_validation
+ assert_equal 'attribute_45', company.attribute_45
+ end
+
+ def test_should_set_its_attribute_46_unless_its_after_save_unless_with_string_condition_when_sent_save
+ company = Company.new :attribute_46 => 'after_save_unless_with_string_condition'
+
+ assert company.save_without_validation
+ assert_equal 'after_save_unless_with_string_condition', company.attribute_46
+ assert company.save_without_validation
+ assert_equal 'after_save_unless_with_string_condition', company.attribute_46
+
+ company = Company.new
+
+ assert company.save_without_validation
+ assert_equal 'attribute_46', company.attribute_46
+
+ company.attribute_46 = ''
+
+ assert company.save_without_validation
+ assert_equal 'attribute_46', company.attribute_46
+ end
+
+ def test_should_set_its_attribute_47_if_its_before_destroy_if_with_string_condition_when_sent_destroy
+ company = Company.new
+
+ assert company.save_without_validation
+ assert_nil company.attribute_47
+
+ company.attribute_47 = 'before_destroy_if_with_string_condition'
+ assert company.destroy
+ assert_equal 'attribute_47', company.attribute_47
+
+ company = Company.new
+
+ assert company.save_without_validation
+ assert company.destroy
+ assert_nil company.attribute_47
+ end
+
+ def test_should_set_its_attribute_48_unless_its_before_destroy_unless_with_string_condition_when_sent_destroy
+ company = Company.new :attribute_48 => 'before_destroy_unless_with_string_condition'
+
+ assert company.save_without_validation
+ assert company.destroy
+ assert_equal 'before_destroy_unless_with_string_condition', company.attribute_48
+
+ company = Company.new
+
+ assert company.save_without_validation
+ assert_nil company.attribute_48
+ assert company.destroy
+ assert_equal 'attribute_48', company.attribute_48
+ end
+
+ def test_should_set_its_attribute_49_if_its_after_destroy_if_with_string_condition_when_sent_destroy
+ company = Company.new
+
+ assert company.save_without_validation
+ assert_nil company.attribute_49
+
+ company.attribute_49 = 'after_destroy_if_with_string_condition'
+ assert company.destroy
+ assert_equal 'attribute_49', company.attribute_49
+
+ company = Company.new
+
+ assert company.save_without_validation
+ assert company.destroy
+ assert_nil company.attribute_49
+ end
+
+ def test_should_set_its_attribute_50_unless_its_after_destroy_unless_with_string_condition_when_sent_destroy
+ company = Company.new :attribute_50 => 'after_destroy_unless_with_string_condition'
+
+ assert company.save_without_validation
+ assert company.destroy
+ assert_equal 'after_destroy_unless_with_string_condition', company.attribute_50
+
+ company = Company.new
+
+ assert company.save_without_validation
+ assert_nil company.attribute_50
+ assert company.destroy
+ assert_equal 'attribute_50', company.attribute_50
+ end
+
+ def test_should_set_its_attribute_51_if_its_before_update_if_with_string_condition_when_sent_save_on_an_update
+ company = Company.new
+
+ assert company.save_without_validation
+ assert_nil company.attribute_51
+
+ company.attribute_51 = 'before_update_if_with_string_condition'
+ assert company.save_without_validation
+ assert_equal 'attribute_51', company.attribute_51
+
+ company = Company.new
+
+ assert company.save_without_validation
+ assert company.save_without_validation
+ assert_nil company.attribute_51
+ end
+
+ def test_should_set_its_attribute_52_unless_its_before_update_unless_with_string_condition_when_sent_save_on_an_update
+ company = Company.new :attribute_52 => 'before_update_unless_with_string_condition'
+
+ assert company.save_without_validation
+ assert company.save_without_validation
+ assert_equal 'before_update_unless_with_string_condition', company.attribute_52
+
+ company = Company.new
+
+ assert company.save_without_validation
+ assert_nil company.attribute_52
+ assert company.save_without_validation
+ assert_equal 'attribute_52', company.attribute_52
end
+
+ def test_should_set_its_attribute_53_if_its_after_update_if_with_string_condition_when_sent_save_on_an_update
+ company = Company.new
+
+ assert company.save_without_validation
+ assert_nil company.attribute_53
+
+ company.attribute_53 = 'after_update_if_with_string_condition'
+ assert company.save_without_validation
+ assert_equal 'attribute_53', company.attribute_53
+
+ company = Company.new
+
+ assert company.save_without_validation
+ assert company.save_without_validation
+ assert_nil company.attribute_53
+ end
+
+ def test_should_set_its_attribute_54_unless_its_after_update_unless_with_string_condition_when_sent_on_an_update
+ company = Company.new :attribute_54 => 'after_update_unless_with_string_condition'
+
+ assert company.save_without_validation
+ assert company.save_without_validation
+ assert_equal 'after_update_unless_with_string_condition', company.attribute_54
+
+ company = Company.new
+
+ assert company.save_without_validation
+ assert_nil company.attribute_54
+ assert company.save_without_validation
+ assert_equal 'attribute_54', company.attribute_54
+ end
+
+ def test_should_set_its_attribute_55_if_its_before_validation_if_with_string_condition_when_sent_valid?
+ company = Company.new :attribute_55 => 'before_validation_if_with_string_condition'
+ company.valid?
+ assert_equal 'attribute_55', company.attribute_55
+
+ company = Company.new
+ company.valid?
+ assert_nil company.attribute_55
+ end
+
+ def test_should_set_its_attribute_56_unless_its_before_validation_unless_with_string_condition_when_sent_valid?
+ company = Company.new :attribute_56 => 'before_validation_unless_with_string_condition'
+ company.valid?
+ assert_equal 'before_validation_unless_with_string_condition', company.attribute_56
+
+ company = Company.new
+ company.valid?
+ assert_equal 'attribute_56', company.attribute_56
+ end
+
+ def test_should_set_its_attribute_57_if_its_after_validation_if_with_string_condition_when_sent_valid?
+ company = Company.new :attribute_57 => 'after_validation_if_with_string_condition'
+ company.valid?
+ assert_equal 'attribute_57', company.attribute_57
+
+ company = Company.new
+ company.valid?
+ assert_nil company.attribute_57
+ end
+
+ def test_should_set_its_attribute_58_unless_its_after_validation_unless_with_string_condition_when_sent_valid?
+ company = Company.new :attribute_58 => 'after_validation_unless_with_string_condition'
+ company.valid?
+ assert_equal 'after_validation_unless_with_string_condition', company.attribute_58
+
+ company = Company.new
+ company.valid?
+ assert_equal 'attribute_58', company.attribute_58
+ end
+
+ def test_should_set_its_attribute_59_if_its_before_validation_on_create_if_with_string_condition_when_sent_valid?
+ company = Company.new :attribute_59 => 'before_validation_on_create_if_with_string_condition'
+ company.valid?
+ assert_equal 'attribute_59', company.attribute_59
+
+ company = Company.new
+ company.valid?
+ assert_nil company.attribute_59
+ end
+
+ def test_should_set_its_attribute_60_unless_its_before_validation_on_create_unless_with_string_condition_when_sent_valid?
+ company = Company.new :attribute_60 => 'before_validation_on_create_unless_with_string_condition'
+ company.valid?
+ assert_equal 'before_validation_on_create_unless_with_string_condition', company.attribute_60
+
+ company = Company.new
+ company.valid?
+ assert_equal 'attribute_60', company.attribute_60
+ end
+
+ def test_should_set_its_attribute_61_if_its_after_validation_on_create_if_with_string_condition_when_sent_valid?
+ company = Company.new :attribute_61 => 'after_validation_on_create_if_with_string_condition'
+ company.valid?
+ assert_equal 'attribute_61', company.attribute_61
+
+ company = Company.new
+ company.valid?
+ assert_nil company.attribute_61
+ end
+
+ def test_should_set_its_attribute_62_unless_its_after_validation_on_create_unless_with_string_condition_when_sent_valid?
+ company = Company.new :attribute_62 => 'after_validation_on_create_unless_with_string_condition'
+ company.valid?
+ assert_equal 'after_validation_on_create_unless_with_string_condition', company.attribute_62
+
+ company = Company.new
+ company.valid?
+ assert_equal 'attribute_62', company.attribute_62
+ end
+
+ def test_should_set_its_attribute_63_if_its_before_validation_on_update_if_with_string_condition_when_sent_valid?
+ company = Company.new :attribute_63 => 'before_validation_on_update_if_with_string_condition'
+ assert company.save_without_validation
+ company.valid?
+ assert_equal 'attribute_63', company.attribute_63
+
+ company = Company.new
+ assert company.save_without_validation
+ company.valid?
+ assert_nil company.attribute_63
+ end
+
+ def test_should_set_its_attribute_64_unless_its_before_validation_on_update_unless_with_string_condition_when_sent_valid?
+ company = Company.new :attribute_64 => 'before_validation_on_update_unless_with_string_condition'
+ assert company.save_without_validation
+ company.valid?
+ assert_equal 'before_validation_on_update_unless_with_string_condition', company.attribute_64
+
+ company = Company.new
+ assert company.save_without_validation
+ company.valid?
+ assert_equal 'attribute_64', company.attribute_64
+ end
+
+ def test_should_set_its_attribute_65_if_its_after_validation_on_update_if_with_string_condition_when_sent_valid?
+ company = Company.new :attribute_65 => 'after_validation_on_update_if_with_string_condition'
+ assert company.save_without_validation
+ company.valid?
+ assert_equal 'attribute_65', company.attribute_65
+
+ company = Company.new
+ assert company.save_without_validation
+ company.valid?
+ assert_nil company.attribute_65
+ end
+
+ def test_should_set_its_attribute_66_unless_its_after_validation_on_update_unless_with_string_condition_when_sent_valid?
+ company = Company.new :attribute_66 => 'after_validation_on_update_unless_with_string_condition'
+ assert company.save_without_validation
+ company.valid?
+ assert_equal 'after_validation_on_update_unless_with_string_condition', company.attribute_66
+
+ company = Company.new
+ assert company.save_without_validation
+ company.valid?
+ assert_equal 'attribute_66', company.attribute_66
+ end
+
+ def test_should_set_its_attribute_67_if_its_after_initialize_if_with_string_condition_when_sent_new
+ company = Company.new :attribute_67 => 'after_initialize_if_with_string_condition'
+ assert_equal 'attribute_67', company.attribute_67
+
+ company = Company.new
+ assert_nil company.attribute_67
+ end
+
+ def test_should_set_its_attribute_68_unless_its_after_initialize_unless_with_string_condition_when_sent_new
+ company = Company.new :attribute_68 => 'after_initialize_unless_with_string_condition'
+ assert_equal 'after_initialize_unless_with_string_condition', company.attribute_68
+
+ company = Company.new
+ assert_equal 'attribute_68', company.attribute_68
+ end
+
+ def test_should_set_its_attribute_69_if_its_name_is_after_find_if_with_string_condition_when_sent_find
+ company = Company.new :name => 'after_find_if_with_string_condition'
+ assert company.save
+
+ company = Company.find company.id
+ assert_equal 'attribute_69', company.attribute_69
+ end
+
+ def test_should_set_its_attribute_70_unless_its_name_is_after_find_unless_with_string_condition_when_sent_find
+ company = Company.new :name => 'after_find_unless_with_string_condition'
+ assert company.save
+
+ company = Company.find company.id
+ assert_nil company.attribute_70
+
+ company = Company.new :name => 'name'
+ assert company.save
+
+ company = Company.find company.id
+ assert_equal 'attribute_70', company.attribute_70
+ end
+
+ def test_should_set_its_attribute_71_if_its_validate_if_with_string_condition_when_sent_valid?
+ company = Company.new :attribute_71 => 'validate_if_with_string_condition'
+ company.valid?
+ assert_equal 'attribute_71', company.attribute_71
+
+ company = Company.new
+ company.valid?
+ assert_nil company.attribute_71
+ end
+
+ def test_should_set_its_attribute_72_unless_its_validate_unless_with_string_condition_when_sent_valid?
+ company = Company.new :attribute_72 => 'validate_unless_with_string_condition'
+ company.valid?
+ assert_equal 'validate_unless_with_string_condition', company.attribute_72
+
+ company = Company.new
+ company.valid?
+ assert_equal 'attribute_72', company.attribute_72
+ end
+
+ def test_should_set_its_attribute_73_if_its_validate_on_create_if_with_string_condition_when_sent_valid?
+ company = Company.new :attribute_73 => 'validate_on_create_if_with_string_condition'
+ company.valid?
+ assert_equal 'attribute_73', company.attribute_73
+
+ company = Company.new
+ company.valid?
+ assert_nil company.attribute_73
+ end
+
+ def test_should_set_its_attribute_74_unless_its_validate_on_create_unless_with_string_condition_when_sent_valid?
+ company = Company.new :attribute_74 => 'validate_on_create_unless_with_string_condition'
+ company.valid?
+ assert_equal 'validate_on_create_unless_with_string_condition', company.attribute_74
+
+ company = Company.new
+ company.valid?
+ assert_equal 'attribute_74', company.attribute_74
+ end
+
+ def test_should_set_its_attribute_75_if_its_validate_on_update_if_with_string_condition_when_sent_valid?
+ company = Company.new :attribute_75 => 'validate_on_update_if_with_string_condition'
+ assert company.save_without_validation
+ company.valid?
+ assert_equal 'attribute_75', company.attribute_75
+
+ company = Company.new
+ assert company.save_without_validation
+ company.valid?
+ assert_nil company.attribute_75
+ end
+
+ def test_should_set_its_attribute_76_unless_its_validate_on_update_unless_with_string_condition_when_sent_valid?
+ company = Company.new :attribute_76 => 'validate_on_update_unless_with_string_condition'
+ assert company.save_without_validation
+ company.valid?
+ assert_equal 'validate_on_update_unless_with_string_condition', company.attribute_76
+
+ company = Company.new
+ assert company.save_without_validation
+ company.valid?
+ assert_equal 'attribute_76', company.attribute_76
+ end
+
+ def test_should_set_its_attribute_77_if_its_before_create_if_with_symbol_condition_when_sent_save_on_initial_creation
+ company = Company.new :attribute_77 => 'before_create_if_with_symbol_condition'
+
+ assert company.save_without_validation
+ assert_equal 'attribute_77', company.attribute_77
+
+ company = Company.new
+
+ assert company.save_without_validation
+ assert_nil company.attribute_77
+ end
+
+ def test_should_set_its_attribute_78_unless_its_before_create_unless_with_symbol_condition_when_sent_save_on_initial_creation
+ company = Company.new :attribute_78 => 'before_create_unless_with_symbol_condition'
+
+ assert company.save_without_validation
+ assert_equal 'before_create_unless_with_symbol_condition', company.attribute_78
+
+ company = Company.new
+
+ assert company.save_without_validation
+ assert_equal 'attribute_78', company.attribute_78
+ end
+
+ def test_should_set_its_attribute_79_if_its_after_create_if_with_symbol_condition_when_sent_save_on_initial_creation
+ company = Company.new :attribute_79 => 'after_create_if_with_symbol_condition'
+
+ assert company.save_without_validation
+ assert_equal 'attribute_79', company.attribute_79
+
+ company = Company.new
+
+ assert company.save_without_validation
+ assert_nil company.attribute_79
+ end
+
+ def test_should_set_its_attribute_80_unless_its_after_create_unless_with_symbol_condition_when_sent_save_on_initial_creation
+ company = Company.new :attribute_80 => 'after_create_unless_with_symbol_condition'
+
+ assert company.save_without_validation
+ assert_equal 'after_create_unless_with_symbol_condition', company.attribute_80
+
+ company = Company.new
+
+ assert company.save_without_validation
+ assert_equal 'attribute_80', company.attribute_80
+ end
+
+ def test_should_set_its_attribute_81_if_its_before_save_if_with_symbol_condition_when_sent_save
+ company = Company.new :attribute_81 => 'before_save_if_with_symbol_condition'
+
+ assert company.save_without_validation
+ assert_equal 'attribute_81', company.attribute_81
+
+ company = Company.new
+
+ assert company.save_without_validation
+ assert_nil company.attribute_81
+
+ company.attribute_81 = 'before_save_if_with_symbol_condition'
+
+ assert company.save_without_validation
+ assert_equal 'attribute_81', company.attribute_81
+ end
+
+ def test_should_set_its_attribute_82_unless_its_before_save_unless_with_symbol_condition_when_sent_save
+ company = Company.new :attribute_82 => 'before_save_unless_with_symbol_condition'
+
+ assert company.save_without_validation
+ assert_equal 'before_save_unless_with_symbol_condition', company.attribute_82
+ assert company.save_without_validation
+ assert_equal 'before_save_unless_with_symbol_condition', company.attribute_82
+
+ company = Company.new
+
+ assert company.save_without_validation
+ assert_equal 'attribute_82', company.attribute_82
+
+ company.attribute_82 = ''
+
+ assert company.save_without_validation
+ assert_equal 'attribute_82', company.attribute_82
+ end
+
+ def test_should_set_its_attribute_83_if_its_after_save_if_with_symbol_condition_when_sent_save
+ company = Company.new :attribute_83 => 'after_save_if_with_symbol_condition'
+
+ assert company.save_without_validation
+ assert_equal 'attribute_83', company.attribute_83
+
+ company = Company.new
+
+ assert company.save_without_validation
+ assert_nil company.attribute_83
+
+ company.attribute_83 = 'after_save_if_with_symbol_condition'
+
+ assert company.save_without_validation
+ assert_equal 'attribute_83', company.attribute_83
+ end
+
+ def test_should_set_its_attribute_84_unless_its_after_save_unless_with_symbol_condition_when_sent_save
+ company = Company.new :attribute_84 => 'after_save_unless_with_symbol_condition'
+
+ assert company.save_without_validation
+ assert_equal 'after_save_unless_with_symbol_condition', company.attribute_84
+ assert company.save_without_validation
+ assert_equal 'after_save_unless_with_symbol_condition', company.attribute_84
+
+ company = Company.new
+
+ assert company.save_without_validation
+ assert_equal 'attribute_84', company.attribute_84
+
+ company.attribute_84 = ''
+
+ assert company.save_without_validation
+ assert_equal 'attribute_84', company.attribute_84
+ end
+
+ def test_should_set_its_attribute_85_if_its_before_destroy_if_with_symbol_condition_when_sent_destroy
+ company = Company.new
+
+ assert company.save_without_validation
+ assert_nil company.attribute_85
+
+ company.attribute_85 = 'before_destroy_if_with_symbol_condition'
+ assert company.destroy
+ assert_equal 'attribute_85', company.attribute_85
+
+ company = Company.new
+
+ assert company.save_without_validation
+ assert company.destroy
+ assert_nil company.attribute_85
+ end
+
+ def test_should_set_its_attribute_86_unless_its_before_destroy_unless_with_symbol_condition_when_sent_destroy
+ company = Company.new :attribute_86 => 'before_destroy_unless_with_symbol_condition'
+
+ assert company.save_without_validation
+ assert company.destroy
+ assert_equal 'before_destroy_unless_with_symbol_condition', company.attribute_86
+
+ company = Company.new
+
+ assert company.save_without_validation
+ assert_nil company.attribute_86
+ assert company.destroy
+ assert_equal 'attribute_86', company.attribute_86
+ end
+
+ def test_should_set_its_attribute_87_if_its_after_destroy_if_with_symbol_condition_when_sent_destroy
+ company = Company.new
+
+ assert company.save_without_validation
+ assert_nil company.attribute_87
+
+ company.attribute_87 = 'after_destroy_if_with_symbol_condition'
+ assert company.destroy
+ assert_equal 'attribute_87', company.attribute_87
+
+ company = Company.new
+
+ assert company.save_without_validation
+ assert company.destroy
+ assert_nil company.attribute_87
+ end
+
+ def test_should_set_its_attribute_88_unless_its_after_destroy_unless_with_symbol_condition_when_sent_destroy
+ company = Company.new :attribute_88 => 'after_destroy_unless_with_symbol_condition'
+
+ assert company.save_without_validation
+ assert company.destroy
+ assert_equal 'after_destroy_unless_with_symbol_condition', company.attribute_88
+
+ company = Company.new
+
+ assert company.save_without_validation
+ assert_nil company.attribute_88
+ assert company.destroy
+ assert_equal 'attribute_88', company.attribute_88
+ end
+
+ def test_should_set_its_attribute_89_if_its_before_update_if_with_symbol_condition_when_sent_save_on_an_update
+ company = Company.new
+
+ assert company.save_without_validation
+ assert_nil company.attribute_89
+
+ company.attribute_89 = 'before_update_if_with_symbol_condition'
+ assert company.save_without_validation
+ assert_equal 'attribute_89', company.attribute_89
+
+ company = Company.new
+
+ assert company.save_without_validation
+ assert company.save_without_validation
+ assert_nil company.attribute_89
+ end
+
+ def test_should_set_its_attribute_90_unless_its_before_update_unless_with_symbol_condition_when_sent_save_on_an_update
+ company = Company.new :attribute_90 => 'before_update_unless_with_symbol_condition'
+
+ assert company.save_without_validation
+ assert company.save_without_validation
+ assert_equal 'before_update_unless_with_symbol_condition', company.attribute_90
+
+ company = Company.new
+
+ assert company.save_without_validation
+ assert_nil company.attribute_90
+ assert company.save_without_validation
+ assert_equal 'attribute_90', company.attribute_90
+ end
+
+ def test_should_set_its_attribute_91_if_its_after_update_if_with_symbol_condition_when_sent_save_on_an_update
+ company = Company.new
+
+ assert company.save_without_validation
+ assert_nil company.attribute_91
+
+ company.attribute_91 = 'after_update_if_with_symbol_condition'
+ assert company.save_without_validation
+ assert_equal 'attribute_91', company.attribute_91
+
+ company = Company.new
+
+ assert company.save_without_validation
+ assert company.save_without_validation
+ assert_nil company.attribute_91
+ end
+
+ def test_should_set_its_attribute_92_unless_its_after_update_unless_with_symbol_condition_when_sent_on_an_update
+ company = Company.new :attribute_92 => 'after_update_unless_with_symbol_condition'
+
+ assert company.save_without_validation
+ assert company.save_without_validation
+ assert_equal 'after_update_unless_with_symbol_condition', company.attribute_92
+
+ company = Company.new
+
+ assert company.save_without_validation
+ assert_nil company.attribute_92
+ assert company.save_without_validation
+ assert_equal 'attribute_92', company.attribute_92
+ end
+
+ def test_should_set_its_attribute_93_if_its_before_validation_if_with_symbol_condition_when_sent_valid?
+ company = Company.new :attribute_93 => 'before_validation_if_with_symbol_condition'
+ company.valid?
+ assert_equal 'attribute_93', company.attribute_93
+
+ company = Company.new
+ company.valid?
+ assert_nil company.attribute_93
+ end
+
+ def test_should_set_its_attribute_94_unless_its_before_validation_unless_with_symbol_condition_when_sent_valid?
+ company = Company.new :attribute_94 => 'before_validation_unless_with_symbol_condition'
+ company.valid?
+ assert_equal 'before_validation_unless_with_symbol_condition', company.attribute_94
+
+ company = Company.new
+ company.valid?
+ assert_equal 'attribute_94', company.attribute_94
+ end
+
+ def test_should_set_its_attribute_95_if_its_after_validation_if_with_symbol_condition_when_sent_valid?
+ company = Company.new :attribute_95 => 'after_validation_if_with_symbol_condition'
+ company.valid?
+ assert_equal 'attribute_95', company.attribute_95
+
+ company = Company.new
+ company.valid?
+ assert_nil company.attribute_95
+ end
+
+ def test_should_set_its_attribute_96_unless_its_after_validation_unless_with_symbol_condition_when_sent_valid?
+ company = Company.new :attribute_96 => 'after_validation_unless_with_symbol_condition'
+ company.valid?
+ assert_equal 'after_validation_unless_with_symbol_condition', company.attribute_96
+
+ company = Company.new
+ company.valid?
+ assert_equal 'attribute_96', company.attribute_96
+ end
+
+ def test_should_set_its_attribute_97_if_its_before_validation_on_create_if_with_symbol_condition_when_sent_valid?
+ company = Company.new :attribute_97 => 'before_validation_on_create_if_with_symbol_condition'
+ company.valid?
+ assert_equal 'attribute_97', company.attribute_97
+
+ company = Company.new
+ company.valid?
+ assert_nil company.attribute_97
+ end
+
+ def test_should_set_its_attribute_98_unless_its_before_validation_on_create_unless_with_symbol_condition_when_sent_valid?
+ company = Company.new :attribute_98 => 'before_validation_on_create_unless_with_symbol_condition'
+ company.valid?
+ assert_equal 'before_validation_on_create_unless_with_symbol_condition', company.attribute_98
+
+ company = Company.new
+ company.valid?
+ assert_equal 'attribute_98', company.attribute_98
+ end
+
+ def test_should_set_its_attribute_99_if_its_after_validation_on_create_if_with_symbol_condition_when_sent_valid?
+ company = Company.new :attribute_99 => 'after_validation_on_create_if_with_symbol_condition'
+ company.valid?
+ assert_equal 'attribute_99', company.attribute_99
+
+ company = Company.new
+ company.valid?
+ assert_nil company.attribute_99
+ end
+
+ def test_should_set_its_attribute_100_unless_its_after_validation_on_create_unless_with_symbol_condition_when_sent_valid?
+ company = Company.new :attribute_100 => 'after_validation_on_create_unless_with_symbol_condition'
+ company.valid?
+ assert_equal 'after_validation_on_create_unless_with_symbol_condition', company.attribute_100
+
+ company = Company.new
+ company.valid?
+ assert_equal 'attribute_100', company.attribute_100
+ end
+
+ def test_should_set_its_attribute_101_if_its_before_validation_on_update_if_with_symbol_condition_when_sent_valid?
+ company = Company.new :attribute_101 => 'before_validation_on_update_if_with_symbol_condition'
+ assert company.save_without_validation
+ company.valid?
+ assert_equal 'attribute_101', company.attribute_101
+
+ company = Company.new
+ assert company.save_without_validation
+ company.valid?
+ assert_nil company.attribute_101
+ end
+
+ def test_should_set_its_attribute_102_unless_its_before_validation_on_update_unless_with_symbol_condition_when_sent_valid?
+ company = Company.new :attribute_102 => 'before_validation_on_update_unless_with_symbol_condition'
+ assert company.save_without_validation
+ company.valid?
+ assert_equal 'before_validation_on_update_unless_with_symbol_condition', company.attribute_102
+
+ company = Company.new
+ assert company.save_without_validation
+ company.valid?
+ assert_equal 'attribute_102', company.attribute_102
+ end
+
+ def test_should_set_its_attribute_103_if_its_after_validation_on_update_if_with_symbol_condition_when_sent_valid?
+ company = Company.new :attribute_103 => 'after_validation_on_update_if_with_symbol_condition'
+ assert company.save_without_validation
+ company.valid?
+ assert_equal 'attribute_103', company.attribute_103
+
+ company = Company.new
+ assert company.save_without_validation
+ company.valid?
+ assert_nil company.attribute_103
+ end
+
+ def test_should_set_its_attribute_104_unless_its_after_validation_on_update_unless_with_symbol_condition_when_sent_valid?
+ company = Company.new :attribute_104 => 'after_validation_on_update_unless_with_symbol_condition'
+ assert company.save_without_validation
+ company.valid?
+ assert_equal 'after_validation_on_update_unless_with_symbol_condition', company.attribute_104
+
+ company = Company.new
+ assert company.save_without_validation
+ company.valid?
+ assert_equal 'attribute_104', company.attribute_104
+ end
+
+ def test_should_set_its_attribute_105_if_its_after_initialize_if_with_symbol_condition_when_sent_new
+ company = Company.new :attribute_105 => 'after_initialize_if_with_symbol_condition'
+ assert_equal 'attribute_105', company.attribute_105
+
+ company = Company.new
+ assert_nil company.attribute_105
+ end
+
+ def test_should_set_its_attribute_106_unless_its_after_initialize_unless_with_symbol_condition_when_sent_new
+ company = Company.new :attribute_106 => 'after_initialize_unless_with_symbol_condition'
+ assert_equal 'after_initialize_unless_with_symbol_condition', company.attribute_106
+
+ company = Company.new
+ assert_equal 'attribute_106', company.attribute_106
+ end
+
+ def test_should_set_its_attribute_107_if_its_name_is_after_find_if_with_symbol_condition_when_sent_find
+ company = Company.new :name => 'after_find_if_with_symbol_condition'
+ assert company.save
+
+ company = Company.find company.id
+ assert_equal 'attribute_107', company.attribute_107
+ end
+
+ def test_should_set_its_attribute_108_unless_its_name_is_after_find_unless_with_symbol_condition_when_sent_find
+ company = Company.new :name => 'after_find_unless_with_symbol_condition'
+ assert company.save
+
+ company = Company.find company.id
+ assert_nil company.attribute_108
+
+ company = Company.new :name => 'name'
+ assert company.save
+
+ company = Company.find company.id
+ assert_equal 'attribute_108', company.attribute_108
+ end
+
+ def test_should_set_its_attribute_109_if_its_validate_if_with_symbol_condition_when_sent_valid?
+ company = Company.new :attribute_109 => 'validate_if_with_symbol_condition'
+ company.valid?
+ assert_equal 'attribute_109', company.attribute_109
+
+ company = Company.new
+ company.valid?
+ assert_nil company.attribute_109
+ end
+
+ def test_should_set_its_attribute_110_unless_its_validate_unless_with_symbol_condition_when_sent_valid?
+ company = Company.new :attribute_110 => 'validate_unless_with_symbol_condition'
+ company.valid?
+ assert_equal 'validate_unless_with_symbol_condition', company.attribute_110
+
+ company = Company.new
+ company.valid?
+ assert_equal 'attribute_110', company.attribute_110
+ end
+
+ def test_should_set_its_attribute_111_if_its_validate_on_create_if_with_symbol_condition_when_sent_valid?
+ company = Company.new :attribute_111 => 'validate_on_create_if_with_symbol_condition'
+ company.valid?
+ assert_equal 'attribute_111', company.attribute_111
+
+ company = Company.new
+ company.valid?
+ assert_nil company.attribute_111
+ end
+
+ def test_should_set_its_attribute_112_unless_its_validate_on_create_unless_with_symbol_condition_when_sent_valid?
+ company = Company.new :attribute_112 => 'validate_on_create_unless_with_symbol_condition'
+ company.valid?
+ assert_equal 'validate_on_create_unless_with_symbol_condition', company.attribute_112
+
+ company = Company.new