Class: TestFriendly::Global
- Inherits:
-
Object
- Object
- TestFriendly::Global
- Defined in:
- lib/global.rb
Class Method Summary collapse
- .add_model(model) ⇒ Object
- .callbacks_on? ⇒ Boolean
- .drop_callbacks(tag = :defaults) ⇒ Object
- .drop_validations(tag = :defaults) ⇒ Object
- .force_callbacks(tag = :defaults) ⇒ Object
- .force_validations(tag = :defaults) ⇒ Object
Class Method Details
.add_model(model) ⇒ Object
4 5 6 7 8 |
# File 'lib/global.rb', line 4 def self.add_model(model) @models ||= [] @models << model @models.uniq! end |
.callbacks_on? ⇒ Boolean
38 39 40 |
# File 'lib/global.rb', line 38 def self.callbacks_on? Rails.env != 'test' end |
.drop_callbacks(tag = :defaults) ⇒ Object
31 32 33 34 35 36 |
# File 'lib/global.rb', line 31 def self.drop_callbacks(tag = :defaults) @models ||= [] @models.each do |model| model.drop_callbacks(tag) end end |
.drop_validations(tag = :defaults) ⇒ Object
24 25 26 27 28 29 |
# File 'lib/global.rb', line 24 def self.drop_validations(tag = :defaults) @models ||= [] @models.each do |model| model.drop_validations(tag) end end |
.force_callbacks(tag = :defaults) ⇒ Object
17 18 19 20 21 22 |
# File 'lib/global.rb', line 17 def self.force_callbacks(tag = :defaults) @models ||= [] @models.each do |model| model.force_callbacks(tag) end end |
.force_validations(tag = :defaults) ⇒ Object
10 11 12 13 14 15 |
# File 'lib/global.rb', line 10 def self.force_validations(tag = :defaults) @models ||= [] @models.each do |model| model.force_validations(tag) end end |