spec/pingfm/client_spec.rb in pingfm-2.1.0 vs spec/pingfm/client_spec.rb in pingfm-2.1.2
- old
+ new
@@ -1,7 +1,9 @@
require 'spec_helper'
+# TODO: These specs kinda suck.
+
describe Pingfm::Client do
it 'should have an API_URL' do
Pingfm::Client::API_URL.should_not be_nil
end
@@ -154,9 +156,41 @@
# call and verify
result = @client.tpost('foo','twt')
result.should_not be_empty
result['status'].should_not be_nil
result['status'].should eql('OK')
+ end
+
+ it "should get the user app key from the mobile_key" do
+ init_user_key_response
+
+ uri = URI.parse "#{Pingfm::Client::API_URL}/#{@service_type}"
+ @params.merge!('mobile_key' => @mobile_key)
+
+ http_resp = mock('response')
+ http_resp.should_receive(:body).and_return(@response)
+ Net::HTTP.should_receive(:post_form).with(uri, @params).and_return(http_resp)
+
+ result = @client.user_key(@mobile_key)
+ result.should_not be_empty
+ result['status'].should_not be_nil
+ result['app_key'].should == @app_key
+ end
+
+ it "should get the user's links" do
+ init_user_links_response
+
+ uri = URI.parse "#{Pingfm::Client::API_URL}/#{@service_type}"
+ @params.merge!('limit' => 25, 'order' => 'DESC')
+
+ http_resp = mock('response')
+ http_resp.should_receive(:body).and_return(@response)
+ Net::HTTP.should_receive(:post_form).with(uri, @params).and_return(http_resp)
+
+ result = @client.links
+ result.should_not be_empty
+ result['status'].should_not be_nil
+ result['links'].should_not be_empty
end
end
describe Pingfm::Client, "with error messages" do