Class: IntegrationTest
- Inherits:
-
Object
- Object
- IntegrationTest
- Includes:
- Singleton
- Defined in:
- lib/omnigroupcontacts/integration_test.rb
Instance Attribute Summary collapse
-
#enabled ⇒ Object
Returns the value of attribute enabled.
Instance Method Summary collapse
- #clear_mocks ⇒ Object
-
#initialize ⇒ IntegrationTest
constructor
A new instance of IntegrationTest.
- #mock(provider, mock) ⇒ Object
- #mock_authorization_from_user(provider) ⇒ Object
- #mock_fetch_contacts(provider) ⇒ Object
Constructor Details
#initialize ⇒ IntegrationTest
Returns a new instance of IntegrationTest.
8 9 10 11 |
# File 'lib/omnigroupcontacts/integration_test.rb', line 8 def initialize enabled = false clear_mocks end |
Instance Attribute Details
#enabled ⇒ Object
Returns the value of attribute enabled.
6 7 8 |
# File 'lib/omnigroupcontacts/integration_test.rb', line 6 def enabled @enabled end |
Instance Method Details
#clear_mocks ⇒ Object
13 14 15 |
# File 'lib/omnigroupcontacts/integration_test.rb', line 13 def clear_mocks @mock = {} end |
#mock(provider, mock) ⇒ Object
17 18 19 |
# File 'lib/omnigroupcontacts/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/omnigroupcontacts/integration_test.rb', line 21 def provider [302, {"Content-Type" => "application/x-www-form-urlencoded", "location" => provider.redirect_path}, []] end |
#mock_fetch_contacts(provider) ⇒ Object
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/omnigroupcontacts/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 |