Sha256: 973b9d6c7b5443230487f112bc4532e4cbbd065f0b73535826d74a7f00adaaa6

Contents?: true

Size: 1.36 KB

Versions: 3

Compression:

Stored size: 1.36 KB

Contents

class ApiBaseTests < Test::Unit::TestCase
  describe "Koala API base class" do
    before(:each) do
      @service = Koala::Facebook::API.new  
    end
    
    it "should not include an access token if none was given" do
      Koala.should_receive(:make_request).with(
        anything,
        hash_not_including('access_token' => 1),
        anything,
        anything
      ).and_return(Koala::Response.new(200, "", ""))
      
      @service.api('anything')
    end
    
    it "should include an access token if given" do
      token = 'adfadf'
      service = Koala::Facebook::API.new token
      
      Koala.should_receive(:make_request).with(
        anything,
        hash_including('access_token' => token),
        anything,
        anything
      ).and_return(Koala::Response.new(200, "", ""))
      
      service.api('anything')
    end
    
    it "should properly handle the http_component parameter"
    
    it "should execute a block to test for errors if passed one"
    
    it "should handle rogue true/false as responses" do
      Koala.should_receive(:make_request).and_return(Koala::Response.new(200, 'true', {}))
      @service.api('anything').should be_true
      
      Koala.should_receive(:make_request).and_return(Koala::Response.new(200, 'false', {}))
      @service.api('anything').should be_false
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
koala-0.7.2 spec/koala/api_base_tests.rb
koala-0.7.1 spec/koala/api_base_tests.rb
koala-0.7.0 spec/koala/api_base_tests.rb