Sha256: 9743c5c7fd7f722bb770878bd8605f40291920bd8f26fcbeaf63d4aa3aad6867

Contents?: true

Size: 1.52 KB

Versions: 5

Compression:

Stored size: 1.52 KB

Contents

require 'spec_helper'

describe ApiClient::Dispatcher do
  describe "#_get" do
    before :each do
      FakeWeb.register_uri(:get, "http://api.example.com/user/5", :status => "200")
    end

    it "should return the response code and body" do
      ApiClient::Base._get("http://api.example.com/user/5", {}).should be_a(Net::HTTPOK)
    end
  end

  describe "#_post" do
    before :each do
      FakeWeb.register_uri(:post, "http://api.example.com/user/5", :status => "201")
    end

    it "should return the response code and body" do
      ApiClient::Base._post("http://api.example.com/user/5", {}, {}).should be_a(Net::HTTPCreated)
    end
  end

  describe "#_put" do
    before :each do
      FakeWeb.register_uri(:put, "http://api.example.com/user/5", :status => "200")
    end

    it "should return the response code and body" do
      ApiClient::Base._put("http://api.example.com/user/5", {}, {}).should be_a(Net::HTTPOK)
    end
  end

  describe "#_patch" do
    before :each do
      FakeWeb.register_uri(:patch, "http://api.example.com/user/5", :status => "200")
    end

    it "should return the response code and body" do
      ApiClient::Base._patch("http://api.example.com/user/5", {}, {}).should be_a(Net::HTTPOK)
    end
  end

  describe "#_delete" do
    before :each do
      FakeWeb.register_uri(:delete, "http://api.example.com/user/5", :status => "200")
    end

    it "should return the response code and body" do
      ApiClient::Base._delete("http://api.example.com/user/5", {}).should be_a(Net::HTTPOK)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
api-client-1.5.0 spec/api-client/dispatcher_spec.rb
api-client-1.4.1 spec/api-client/dispatcher_spec.rb
api-client-1.4.0 spec/api-client/dispatcher_spec.rb
api-client-1.3.0 spec/api-client/dispatcher_spec.rb
api-client-1.2.0 spec/api-client/dispatcher_spec.rb