Merge pull request #274 + fix to use FakeFS to avoid flakey test

This commit is contained in:
Steven Bazyl 2015-08-19 13:57:14 -07:00
commit a5a9b49160
3 changed files with 21 additions and 3 deletions

View File

@ -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

View File

@ -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

View File

@ -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