Module: Jbr::Mocking
- Included in:
- Jbr
- Defined in:
- lib/jbr/mocking.rb
Overview
The switch an app under test throws to answer Jobber without a network. Touching #mock once turns every entry point below over to its Mock counterpart.
Instance Method Summary collapse
-
#create_oauth(params = {}) ⇒ OAuth
Credentials for the account that authorized the app.
-
#mock ⇒ Mock
The answers this process gives, created on first use.
-
#oauth_for(params = {}) ⇒ OAuth
Those credentials, ready to read and write with.
-
#oauth_url_for(params = {}) ⇒ String
The URL a Jobber user authorizes the app on.
Instance Method Details
#create_oauth(params = {}) ⇒ OAuth
Returns credentials for the account that authorized the app.
12 13 14 |
# File 'lib/jbr/mocking.rb', line 12 def create_oauth(params = {}) (@mock ? Mock::OAuth : OAuth).create(**params) end |
#mock ⇒ Mock
Returns the answers this process gives, created on first use.
6 7 8 |
# File 'lib/jbr/mocking.rb', line 6 def mock @mock ||= Jbr::Mock.new end |