Sha256: d89b2413c88e206d6d32fa4b3f1b6ba5f5e6ffd484c299fc8236a8de61dfa991
Contents?: true
Size: 1.67 KB
Versions: 2
Compression:
Stored size: 1.67 KB
Contents
require File.dirname(__FILE__) + '/test_helper.rb' class FacebookDataTest < Test::Unit::TestCase def setup @session = Facebooker::Session.create('apikey', 'secretkey') end def test_can_ask_facebook_to_set_a_cookies expect_http_posts_with_responses(example_set_cookie_xml) assert(@session.data.set_cookie(12345, 'name', 'value')) end def test_can_ask_facebook_to_get_cookies expect_http_posts_with_responses(example_get_cookies_xml) assert(@session.data.get_cookies(12345)) end def test_can_get_cookies_for_user mock_http = establish_session mock_http.should_receive(:post_form).and_return(example_get_cookies_xml).once.ordered(:posts) cookies = @session.data.get_cookies(508508326) assert_equal 'Foo', cookies.first.name assert_equal 'Bar', cookies.first.value end private def example_set_cookie_xml <<-XML <?xml version="1.0" encoding="UTF-8"?> <data_setCookie_response xmlns="http://api.facebook.com/1.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://api.facebook.com/1.0/ http://api.facebook.com/1.0/facebook.xsd">1</data_setCookie_response> XML end def example_get_cookies_xml <<-XML <?xml version="1.0" encoding="UTF-8"?> <data_getCookie_response xmlns="http://api.facebook.com/1.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://api.facebook.com/1.0/ http://api.facebook.com/1.0/facebook.xsd"> <cookies> <uid>508508326</uid> <name>Foo</name> <value>Bar</value> <expires>0</expires> <path>/tmp/</path> </cookies> </data_getCookie_response> XML end end
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
yury-facebooker-0.9.5 | test/facebook_data_test.rb |
facebooker-0.9.5 | test/facebook_data_test.rb |