require 'bluekai/client' require 'bluekai/error' RSpec.describe Bluekai::Client do subject { described_class.new(api_private_key: '1234') } describe '#sign' do it 'computes a correct signature' do signature = subject.send(:sign, 'GET', '/Services/WS/classificationCategories/', 'blabli', key1: 'value1', key2: 'value2') expect(signature).to eq('msNdVnof8pNLImtDYxh0KDiMHWqrvjExAEh7UcSLJw8%3D') end end describe '#request' do it 'raises ArgumentError if unknown HTTP method is passed' do expect { subject.send(:request, 'FOO', '123', {}, nil) }.to raise_error(ArgumentError) end end end