Class: Twi::Mock::Phone

Inherits:
Phone show all
Defined in:
lib/twi/mock/phone.rb

Instance Attribute Summary

Attributes inherited from Phone

#id, #number

Instance Method Summary collapse

Methods inherited from Resource

#initialize

Constructor Details

This class inherits a constructor from Twi::Resource

Instance Method Details

#createObject

Answers whatever the suite arranged, an error before anything else and once only, as the message and the call mocks do: an error left behind would refuse every later number.



5
6
7
8
9
10
11
12
13
# File 'lib/twi/mock/phone.rb', line 5

def create
  if error = Twi.mock.phone_error
    Twi.mock.phone_error = nil
    raise Error, error
  elsif Twi.mock.phone
    @id = Twi.mock.phone[:id]
    @number = Twi.mock.phone[:number]
  end
end