-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* refactoring tests to eliminate need for real environment variables during testing * defaulting required environment variables in test
- Loading branch information
Showing
9 changed files
with
55 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 4 additions & 4 deletions
8
spec/fixtures/vcr_cassettes/get_spreadsheet_values_no_range.yml
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,11 +26,26 @@ | |
VCR.configure do |config| | ||
config.cassette_library_dir = 'spec/fixtures/vcr_cassettes' | ||
config.hook_into :webmock | ||
config.filter_sensitive_data('<GOOGLE_API_KEY>') { ENV.fetch('GOOGLE_API_KEY', nil) } | ||
config.filter_sensitive_data('<SPREADSHEET_ID>') { ENV.fetch('GOOGLE_API_SPREADSHEET_ID', nil) } | ||
end | ||
|
||
# make sure all vars required for testing are present | ||
require 'sheet_zoukas/utils' | ||
REQUIRED_VARS_TEST = (SheetZoukas::REQUIRED_VARS + ['GOOGLE_API_SPREADSHEET_ID']).freeze | ||
exit 1 unless SheetZoukas::Utils.vars_present?(REQUIRED_VARS_TEST, 'required for tests to run') | ||
# initialize required environment variables | ||
ENV.store('GOOGLE_ACCOUNT_TYPE', 'service_account') | ||
ENV.store('GOOGLE_API_KEY', 'fake_google_api_key') | ||
ENV.store('GOOGLE_CLIENT_EMAIL', '[email protected]') | ||
ENV.store('GOOGLE_CLIENT_ID', 'fake_google_client_id') | ||
ENV.store('GOOGLE_PRIVATE_KEY', "----BEGIN PRIVATE KEY-----\nfake_google_private_key==\n-----END PRIVATE KEY-----\n") | ||
|
||
module SheetZoukas | ||
# for testing don't try to authenticate with Google | ||
# will need to remove when recording new VCR cassettes | ||
class GoogleSheets | ||
Authorizer = Struct.new(:scope) | ||
|
||
private | ||
|
||
def init_authorizer(scope) | ||
scopes = scope.is_a?(Array) ? scope : [scope] | ||
@authorizer = Authorizer.new(scopes) | ||
end | ||
end | ||
end |