Class: IntegrationTest

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/omnicontacts/integration_test.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeIntegrationTest

Returns a new instance of IntegrationTest.



8
9
10
11
# File 'lib/omnicontacts/integration_test.rb', line 8

def initialize
  enabled = false
  clear_mocks
end

Instance Attribute Details

#enabledObject

Returns the value of attribute enabled.



6
7
8
# File 'lib/omnicontacts/integration_test.rb', line 6

def enabled
  @enabled
end

Instance Method Details

#clear_mocksObject



13
14
15
# File 'lib/omnicontacts/integration_test.rb', line 13

def clear_mocks
  @mock = {}
end

#mock(provider, mock) ⇒ Object



17
18
19
# File 'lib/omnicontacts/integration_test.rb', line 17

def mock provider, mock
  @mock[provider.to_sym] = mock
end

#mock_authorization_from_user(provider) ⇒ Object



21
22
23
# File 'lib/omnicontacts/integration_test.rb', line 21

def mock_authorization_from_user provider
  [302, {"location" => provider.redirect_path}, []]
end

#mock_fetch_contacts(provider) ⇒ Object



25
26
27
28
29
30
31
32
33
34
# File 'lib/omnicontacts/integration_test.rb', line 25

def mock_fetch_contacts provider
  result = @mock[provider.class_name.to_sym] || []
  if result.is_a? Array
    result
  elsif result.is_a? Hash
    [result]
  else
    raise result.to_s
  end
end