Class: TwilioMock::Testing

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

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.__test_modeObject

Returns the value of attribute __test_mode.



4
5
6
# File 'lib/twilio_mock/testing.rb', line 4

def __test_mode
  @__test_mode
end

Class Method Details

.__set_test_mode(mode) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/twilio_mock/testing.rb', line 6

def __set_test_mode(mode)
  if block_given?
    current_mode = self.__test_mode
    begin
      self.__test_mode = mode
      yield
    ensure
      self.__test_mode = current_mode
    end
  else
    self.__test_mode = mode
  end
end

.disable!(&block) ⇒ Object



24
25
26
# File 'lib/twilio_mock/testing.rb', line 24

def disable!(&block)
  __set_test_mode(:disable, &block)
end

.disabled?Boolean

Returns:

  • (Boolean)


32
33
34
# File 'lib/twilio_mock/testing.rb', line 32

def disabled?
  self.__test_mode == :disable
end

.enable!(&block) ⇒ Object



20
21
22
# File 'lib/twilio_mock/testing.rb', line 20

def enable!(&block)
  __set_test_mode(:enable, &block)
end

.enabled?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/twilio_mock/testing.rb', line 28

def enabled?
  self.__test_mode == :enable
end