spec/mangopay/client_spec.rb in mangopay-3.0.31 vs spec/mangopay/client_spec.rb in mangopay-3.0.32
- old
+ new
@@ -5,33 +5,43 @@
clnt = MangoPay::Client.fetch
expect(clnt['ClientId']).to eq(MangoPay.configuration.client_id)
end
end
+ describe 'FETCH' do
+ it "fetches the client headquarter's phone number" do
+ client = MangoPay::Client.fetch
+ expect(client['HeadquartersPhoneNumber']).to_not be_nil
+ end
+ end
+
describe 'UPDATE' do
it 'updates the current client details' do
clnt = MangoPay::Client.fetch
before = clnt['PrimaryThemeColour']
after = before == '#aaaaaa' ? '#bbbbbb' : '#aaaaaa' # change the color
clnt['PrimaryThemeColour'] = after
clnt['HeadquartersAddress'] = {
- AddressLine1: 'Rue Dandelion, n. 17',
- City: 'Lyon',
- Country: 'FR',
- PostalCode: '150770'
+ AddressLine1: 'Rue Dandelion, n. 17',
+ City: 'Lyon',
+ Country: 'FR',
+ PostalCode: '150770'
}
+ phoneNumber = rand(99999999).to_s
+ clnt['HeadquartersPhoneNumber'] = phoneNumber
updated = MangoPay::Client.update(clnt)
expect(updated['ClientId']).to eq(MangoPay.configuration.client_id)
expect(updated['PrimaryThemeColour']).to eq(after)
+ expect(updated['HeadquartersPhoneNumber']).to eq(phoneNumber)
end
end
describe 'UPLOAD LOGO' do
it 'accepts Base64 encoded file content' do
fnm = __FILE__.sub('.rb', '.png')
- bts = File.open(fnm, 'rb') { |f| f.read }
+ bts = File.open(fnm, 'rb') {|f| f.read}
b64 = Base64.encode64(bts)
ret = MangoPay::Client.upload_logo(b64)
expect(ret).to be_nil
end
@@ -41,10 +51,10 @@
expect(ret).to be_nil
end
it 'fails when input string is not base64-encoded' do
file = 'any file content...'
- expect { MangoPay::Client.upload_logo(file) }.to raise_error { |err|
+ expect {MangoPay::Client.upload_logo(file)}.to raise_error {|err|
expect(err).to be_a MangoPay::ResponseError
expect(err.code).to eq '400'
expect(err.type).to eq 'param_error'
}
end