Sha256: 7d1acb6b9dde1da00f0b9c09f4dafec4b2e9db3ed791c80b5d3eea3feca21339
Contents?: true
Size: 1.24 KB
Versions: 1
Compression:
Stored size: 1.24 KB
Contents
require 'spec_helper' describe MarketingCloudSDK::HTTPRequest do let(:client) { Class.new.new.extend MarketingCloudSDK::HTTPRequest } subject { client } it { should respond_to(:get) } it { should respond_to(:post) } it { should respond_to(:patch) } it { should respond_to(:delete) } it { should_not respond_to(:request) } # private method describe '#get' do it 'makes and Net::HTTP::Get request' do client.stub(:request).with(Net::HTTP::Get, 'http://some_url', {}).and_return({'success' => 'get'}) expect(client.get('http://some_url')).to eq 'success' => 'get' end end describe '#post' do describe 'makes and Net::HTTP::Post request' do it 'with only url' do Net::HTTP.any_instance.stub(:request) client.stub(:request).with(Net::HTTP::Post, 'http://some_url', {}).and_return({'success' => 'post'}) expect(client.post('http://some_url')).to eq 'success' => 'post' end it 'with params' do client.stub(:request) .with(Net::HTTP::Post, 'http://some_url', {'params' => {'legacy' => 1}}) .and_return({'success' => 'post'}) expect(client.post('http://some_url', {'params' => {'legacy' => 1}})).to eq 'success' => 'post' end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
marketingcloudsdk-1.0.0 | spec/http_request_spec.rb |