diff --git a/Gemfile b/Gemfile index 2114db4a8..7b151dc5f 100644 --- a/Gemfile +++ b/Gemfile @@ -14,8 +14,8 @@ group :development do gem 'coveralls', '~> 0.7.11' gem 'rubocop', '~> 0.29' gem 'launchy', '~> 2.4' - gem 'dotenv' - gem 'pry-doc' + gem 'dotenv', '~> 2.0' + gem 'fakefs', '~> 0.6', require: "fakefs/safe" end platforms :jruby do @@ -29,7 +29,8 @@ platforms :ruby do gem 'yard', '~> 0.8' gem 'redcarpet', '~> 3.2' gem 'github-markup', '~> 1.3' - gem 'pry-byebug' + gem 'pry-doc', '~> 0.8' + gem 'pry-byebug', '~> 3.2' end end diff --git a/spec/google/api_client/client_secrets_spec.rb b/spec/google/api_client/client_secrets_spec.rb index 822a1ff9f..cf135e369 100644 --- a/spec/google/api_client/client_secrets_spec.rb +++ b/spec/google/api_client/client_secrets_spec.rb @@ -48,6 +48,13 @@ RSpec.describe Google::APIClient::ClientSecrets do expect(hash["installed"]["client_secret"]).to be == 'i8YaXdGgiQ4_KrTVNGsB7QP1' end + it 'should remove empty value' do + expect(hash["installed"]["redirect_uris"]).to be nil + end + + it 'should remove nil values' do + expect(hash["installed"]["issued_at"]).to be nil + end end end @@ -72,4 +79,12 @@ RSpec.describe Google::APIClient::ClientSecrets do expect(secrets.client_id).to be == '898243283568.apps.googleusercontent.com' end end + + context 'with folder wihout client_secrets.json' do + it "should raise exception", fakefs: true do + FileUtils.mkdir("/tmp") + expect { Google::APIClient::ClientSecrets.load('/tmp') }.to raise_exception(ArgumentError) + end + end + end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 0e2565734..af3803ef0 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -43,6 +43,7 @@ end require 'rspec' require 'webmock/rspec' +require 'fakefs/spec_helpers' require 'json_spec' require 'logging' require 'rspec/logging_helper' @@ -53,6 +54,7 @@ require 'google/apis/core/base_service' # logs will be stored in the @log_output variable. It is a StringIO instance. RSpec.configure do |config| include RSpec::LoggingHelper + config.include FakeFS::SpecHelpers, fakefs: true config.include JsonSpec::Helpers config.include WebMock::API config.capture_log_messages