Sha256: cea74bc8c1943582a1210d70585c5bbf9a851df70625d792407d59885e9feff8
Contents?: true
Size: 1.11 KB
Versions: 5
Compression:
Stored size: 1.11 KB
Contents
require 'spec_helper' describe WialonApi::Api do def create_connection @result = { 'response' => { 'key' => 'value' } } @connection = Faraday.new do |builder| builder.response :mashify builder.response :oj, preserve_raw: true builder.adapter :test do |stub| stub.post('/') do [200, {}, Oj.dump(@result)] end end end allow(subject).to receive(:connection).and_return(@connection) end describe '.call' do before(:each) do WialonApi.reset create_connection end it 'sends a sid if it was passed with parameter' do expect(subject).to receive(:connection).with(url: WialonApi.wialon_host) subject.call('core/search_items', { params: :value }, 'sid') end end describe '.connection' do it 'uses the :url parameter and WialonApi.faraday_options' do faraday_options = double('Faraday options') allow(WialonApi).to receive(:faraday_options).and_return(faraday_options) url = double('URL') expect(Faraday).to receive(:new).with(url, faraday_options) subject.connection(url: url) end end end
Version data entries
5 entries across 5 versions & 1 rubygems