e3aacba5227cf71454ef8b00910650c3dbb9927dEugen Kuksarequire 'spec_helper'
e3aacba5227cf71454ef8b00910650c3dbb9927dEugen Kuksa let(:options) { {key1: 'value1', key2: 'value2'} }
e3aacba5227cf71454ef8b00910650c3dbb9927dEugen Kuksa expect(Hets::HetsOptions.new(options).options).to eq(options)
e3aacba5227cf71454ef8b00910650c3dbb9927dEugen Kuksa expect(Hets::HetsOptions.new(options_new).options).to eq(options)
e3aacba5227cf71454ef8b00910650c3dbb9927dEugen Kuksa expect(Hets::HetsOptions.from_hash(hash).options).to eq(options)
e3aacba5227cf71454ef8b00910650c3dbb9927dEugen Kuksa expect(Hets::HetsOptions.from_hash(hash).options).to eq(options)
e3aacba5227cf71454ef8b00910650c3dbb9927dEugen Kuksa let(:hets_options) { Hets::HetsOptions.new(options) }
e3aacba5227cf71454ef8b00910650c3dbb9927dEugen Kuksa let(:additional_options) { {key3: 'value3', key4: 'value4'} }
e3aacba5227cf71454ef8b00910650c3dbb9927dEugen Kuksa expect(hets_options.options).to eq(options.merge(additional_options))
e3aacba5227cf71454ef8b00910650c3dbb9927dEugen Kuksa additional_options_new = {**additional_options, key5: nil}
e3aacba5227cf71454ef8b00910650c3dbb9927dEugen Kuksa expect(hets_options.options).to eq(options.merge(additional_options))
78c1cf25949b565eefa81e71c241c4aafd17b7f2Eugen Kuksa let(:access_token_options) { {**options, :'access-token' => nil} }
78c1cf25949b565eefa81e71c241c4aafd17b7f2Eugen Kuksa let(:hets_options) { Hets::HetsOptions.new(access_token_options) }
78c1cf25949b565eefa81e71c241c4aafd17b7f2Eugen Kuksa expect(hets_options.options.has_key?(:'access-token')).to be(false)
78c1cf25949b565eefa81e71c241c4aafd17b7f2Eugen Kuksa let(:access_token_options) { {**options, :'access-token' => access_token} }
78c1cf25949b565eefa81e71c241c4aafd17b7f2Eugen Kuksa let(:hets_options) { Hets::HetsOptions.new(access_token_options) }
78c1cf25949b565eefa81e71c241c4aafd17b7f2Eugen Kuksa expect(hets_options.options[:'access-token']).to eq(access_token.to_s)
e3aacba5227cf71454ef8b00910650c3dbb9927dEugen Kuksa let(:catalog_options) { {**options, :'url-catalog' => %w()} }
e3aacba5227cf71454ef8b00910650c3dbb9927dEugen Kuksa let(:hets_options) { Hets::HetsOptions.new(catalog_options) }
e3aacba5227cf71454ef8b00910650c3dbb9927dEugen Kuksa expect(hets_options.options.has_key?(:'url-catalog')).to be(false)
e3aacba5227cf71454ef8b00910650c3dbb9927dEugen Kuksa let(:catalog_options) { {**options, :'url-catalog' => [nil, nil]} }
e3aacba5227cf71454ef8b00910650c3dbb9927dEugen Kuksa let(:hets_options) { Hets::HetsOptions.new(catalog_options) }
e3aacba5227cf71454ef8b00910650c3dbb9927dEugen Kuksa expect(hets_options.options.has_key?(:'url-catalog')).to be(false)
e3aacba5227cf71454ef8b00910650c3dbb9927dEugen Kuksa {**options, :'url-catalog' => ['a=b', nil, 'c=d']}
e3aacba5227cf71454ef8b00910650c3dbb9927dEugen Kuksa let(:hets_options) { Hets::HetsOptions.new(catalog_options) }
e3aacba5227cf71454ef8b00910650c3dbb9927dEugen Kuksa it "removes the nil value from :'url-catalog'" do
c73a9fba38c3f997632370857d254425fa5183d7Eugen Kuksa expect(hets_options.options[:'url-catalog']).to eq('a=b,c=d')
e3aacba5227cf71454ef8b00910650c3dbb9927dEugen Kuksa let(:catalog_options) { {**options, :'url-catalog' => %w(a=b c=d)} }
e3aacba5227cf71454ef8b00910650c3dbb9927dEugen Kuksa let(:hets_options) { Hets::HetsOptions.new(catalog_options) }
c73a9fba38c3f997632370857d254425fa5183d7Eugen Kuksa expect(hets_options.options[:'url-catalog']).to eq('a=b,c=d')