From 08b290c3efc92f62adeed34ada0dd65968757828 Mon Sep 17 00:00:00 2001 From: nov Date: Thu, 4 Sep 2014 17:39:50 +0900 Subject: [PATCH] User#applications spec --- spec/fb_graph2/edge/applications_spec.rb | 20 ++++++++++++++++++++ spec/mock_json/user/applications.json | 16 ++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 spec/fb_graph2/edge/applications_spec.rb create mode 100644 spec/mock_json/user/applications.json diff --git a/spec/fb_graph2/edge/applications_spec.rb b/spec/fb_graph2/edge/applications_spec.rb new file mode 100644 index 0000000..e503e72 --- /dev/null +++ b/spec/fb_graph2/edge/applications_spec.rb @@ -0,0 +1,20 @@ +require 'spec_helper' + +describe FbGraph2::Edge::Applications do + context 'included in User' do + let(:me) { FbGraph2::User.me('token') } + + describe '#applications' do + it 'should return an Array of FbGraph2::App' do + apps = mock_graph :get, 'me/applications/developer', 'user/applications', access_token: 'token' do + me.applications + end + apps.should be_instance_of FbGraph2::Edge + apps.should_not be_blank + apps.each do |app| + app.should be_instance_of FbGraph2::App + end + end + end + end +end \ No newline at end of file diff --git a/spec/mock_json/user/applications.json b/spec/mock_json/user/applications.json new file mode 100644 index 0000000..f90d2ae --- /dev/null +++ b/spec/mock_json/user/applications.json @@ -0,0 +1,16 @@ +{ + "data": [{ + "name": "gem sample", + "namespace": "gem-sample", + "id": "210798282372757" + }, { + "name": "Localhost", + "id": "158245434257042" + }, { + "name": "OAuth.jp", + "id": "126213067419995" + }], + "paging": { + "next": "https://graph.facebook.com/v2.1/579612276/applications?type=developer&limit=25&offset=25&__after_id=***" + } +}