Sha256: f8d36f4878164648aea41618dbaf242cede0d25a2288129b54d50451cd547e20

Contents?: true

Size: 1.28 KB

Versions: 10

Compression:

Stored size: 1.28 KB

Contents

# Copyright 2015 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

require 'spec_helper'
require 'google/apis/options'

RSpec.describe Google::Apis::RequestOptions do
  let(:options) { Google::Apis::RequestOptions.new }

  it 'should not merge nil values' do
    options.retries = 1
    expect(options.merge(authorization: 'foo').retries).to eql 1
  end

  it 'should merge non-nil values' do
    options.retries = 1
    expect(options.merge(authorization: 'foo').authorization).to eql 'foo'
  end

  it 'should merge from options' do
    opts = Google::Apis::RequestOptions.new
    opts.authorization = 'foo'
    expect(options.merge(opts).authorization).to eql 'foo'
  end

  it 'should allow nil in merge' do
    expect(options.merge(nil)).to be_an_instance_of(Google::Apis::RequestOptions)
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
google-api-client-0.9.5 spec/google/apis/options_spec.rb
google-api-client-0.9.4 spec/google/apis/options_spec.rb
google-api-client-0.9.3 spec/google/apis/options_spec.rb
google-api-client-0.9.2 spec/google/apis/options_spec.rb
google-api-client-0.9.1 spec/google/apis/options_spec.rb
google-api-client-0.9 spec/google/apis/options_spec.rb
google-api-client-0.9.pre5 spec/google/apis/options_spec.rb
google-api-client-0.9.pre3 spec/google/apis/options_spec.rb
google-api-client-0.9.pre2 spec/google/apis/options_spec.rb
google-api-client-0.9.pre1 spec/google/apis/options_spec.rb