Sha256: f5af52350d9ba137beb69f5a28ead52ab681cd29e8fb30def7884a8d1e70b056
Contents?: true
Size: 1.29 KB
Versions: 3
Compression:
Stored size: 1.29 KB
Contents
require File.join(File.dirname(__FILE__), '..', '..', 'spec_helper') describe Twitter::Client, "#authenticate?" do before(:each) do @uri = '/account/verify_credentials.json' @request = mas_net_http_get(:basic_auth => nil) @twitter = client_context @default_header = @twitter.send(:http_header) @response = mas_net_http_response(:success) @error_response = mas_net_http_response(404, "Resource Not Found") @connection = mas_net_http(@response) Net::HTTP.stub!(:new).and_return(@connection) @access_key = "applestillsucks" @access_secret = "linuxstillrocks" end it "creates expected HTTP GET request" do @twitter.should_receive(:rest_oauth_connect).with(:get, @uri).and_return(@request) @twitter.authenticate?(@access_key, @access_secret) end it "should return true if HTTP response is 20X" do @twitter.authenticate?(@access_key, @access_secret).should be(true) end it "should return false if HTTP response is not 20X" do @twitter.should_receive(:rest_oauth_connect).with(:get, @uri).and_return(@error_response) @twitter.authenticate?(@access_key, @access_secret).should be(false) end after(:each) do nilize(@uri, @request, @twitter, @default_header, @response, @error_response, @connection, @access_key, @access_secret) end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
twitter4r-0.5.2 | spec/twitter/client/auth_spec.rb |
twitter4r-0.5.1 | spec/twitter/client/auth_spec.rb |
twitter4r-0.5.0 | spec/twitter/client/auth_spec.rb |