Module: Quovo::Fake

Included in:
Quovo
Defined in:
lib/quovo/fake.rb

Instance Method Summary collapse

Instance Method Details

#fake!(fake_calls = []) ⇒ Object

format of fake calls [

[:get, "/accounts/id", {}, { id: 123, nickname: '123' ... }]

]



11
12
13
14
15
16
17
18
19
# File 'lib/quovo/fake.rb', line 11

def fake!(fake_calls = [])
  @fake_calls = fake_calls
  @fake = true
  Quovo.config.token_storage = Object.new.tap do |o|
    def o.read(_)
      ['FAKE-TOKEN', (Time.now.utc + 1_000).iso8601].join('|')
    end
  end
end

#fake?Boolean

Returns:

  • (Boolean)


3
4
5
# File 'lib/quovo/fake.rb', line 3

def fake?
  @fake
end

#fake_callsObject



25
26
27
# File 'lib/quovo/fake.rb', line 25

def fake_calls
  @fake_calls
end

#real!Object



21
22
23
# File 'lib/quovo/fake.rb', line 21

def real!
  @fake = false
end