Created
January 17, 2016 23:46
-
-
Save DougPuchalski/f6806f4867f688e6f2d1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rspec' | |
require 'webmock/rspec' | |
WebMock.disable_net_connect! | |
require 'httparty' | |
class MyClass | |
include HTTParty | |
def self.post | |
super("http://example.com/", body: "hello world") | |
end | |
end | |
describe 'Body test' do | |
it 'works with body' do | |
stub_request(:post, "http://example.com/").to_return(:status => 200, :body => "xxx", :headers => {}) | |
response = MyClass.post | |
expect(response).to_not be_nil | |
end | |
it 'works with blank body' do | |
stub_request(:post, "http://example.com/").to_return(:status => 200, :body => "", :headers => {}) | |
response = MyClass.post | |
expect(response).to_not be_nil | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment