Class: TestFriendly::Global

Inherits:
Object
  • Object
show all
Defined in:
lib/global.rb

Class Method Summary collapse

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

Returns:

  • (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