Sha256: 7100a5d428dab89b72d9b8f3fc539c4ff085d473ce6880a5d3d6133654146caa

Contents?: true

Size: 1.43 KB

Versions: 1

Compression:

Stored size: 1.43 KB

Contents

require File.expand_path(File.join(File.dirname(__FILE__),'..', 'spec_helper'))

class AdminApiClientProxyTest
  include Trigga::ParamFu
  include Trigga::AdminApiClient::Proxies::Admin
end

describe Trigga::AdminApiClient::Proxies::Admin do
  before do
    AdminApiClientProxyTest.stub!(:require_one_of).and_return(true)
    AdminApiClientProxyTest.stub!(:require_param).and_return(true)
    Trigga::AdminApiClient.stub!(:make_call).and_return(true)
    @opts = {:abc => 123, :api_key => "blah"}
  end
  
  describe "get_stats" do
    before do
      @opts = {:abc => 123}  
    end
    
    it "should call make_call" do
      Trigga::AdminApiClient.should_receive(:make_call).with("admin","stats",@opts)
      AdminApiClientProxyTest.new.get_stats @opts
    end
  end
  
  
  describe "get_clients" do
    it "should call make_call" do
      Trigga::AdminApiClient.should_receive(:make_call).with("admin","clients",@opts)
      AdminApiClientProxyTest.new.get_clients @opts
    end
  end
  
  
  describe "get_client" do
    before do
      @opts = {:client_id => 42}
    end
    
    it "should require client_id" do
      AdminApiClientProxyTest.should_receive(:require_param).with(@opts, :client_id)
      AdminApiClientProxyTest.new.get_client @opts
    end
    
    it "should call make_call" do
      Trigga::AdminApiClient.should_receive(:make_call).with("admin","clients/42",@opts)
      AdminApiClientProxyTest.new.get_client @opts
    end
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
itrigga-admin_api_client-0.1.2 spec/proxies/admin_spec.rb