mosaic-facebook 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Rakefile +2 -0
- data/lib/mosaic/facebook/api/notification.rb +3 -1
- data/lib/mosaic/facebook/graph/account.rb +3 -6
- data/lib/mosaic/facebook/graph/application.rb +15 -1
- data/lib/mosaic/facebook/graph/graph_object.rb +7 -1
- data/lib/mosaic/facebook/object.rb +2 -12
- data/lib/mosaic/facebook/version.rb +1 -1
- data/spec/api/notification_spec.rb +24 -0
- data/spec/fql/comment_spec.rb +7 -0
- data/spec/fql/post_spec.rb +7 -0
- data/spec/graph/account_spec.rb +48 -0
- data/spec/graph/application_spec.rb +35 -0
- data/spec/graph/comment_spec.rb +7 -0
- data/spec/graph/event_spec.rb +7 -0
- data/spec/graph/insights_spec.rb +7 -0
- data/spec/graph/page_spec.rb +25 -0
- data/spec/graph/post_spec.rb +31 -0
- data/spec/graph/subscription_spec.rb +7 -0
- data/spec/graph/user_spec.rb +38 -0
- data/spec/mosaic-facebook_spec.rb +1 -1
- data/spec/spec.opts +2 -2
- data/spec/spec_helper.rb +2 -0
- metadata +25 -5
- data/spec/mosaic-facebook/notification_spec.rb +0 -25
- data/spec/mosaic-facebook/page_spec.rb +0 -17
data/Rakefile
CHANGED
@@ -9,6 +9,8 @@ Bundler::GemHelper.install_tasks
|
|
9
9
|
desc "Run RSpec"
|
10
10
|
RSpec::Core::RakeTask.new do |t|
|
11
11
|
t.verbose = false
|
12
|
+
t.pattern = ['spec/**/*_spec.rb']
|
13
|
+
t.rspec_opts = ['--options', 'spec/spec.opts']
|
12
14
|
end
|
13
15
|
# Spec::Rake::SpecTask.new(:spec) do |spec|
|
14
16
|
# spec.ruby_opts << '-rubygems'
|
@@ -1,5 +1,7 @@
|
|
1
1
|
require 'mosaic/facebook/error'
|
2
2
|
|
3
|
+
# TODO: fix the namespace (ie. module) this should be Mosaic::Facebook::Api::Notification
|
4
|
+
# or notification.rb should be moved up a folder
|
3
5
|
module Mosaic
|
4
6
|
module Facebook
|
5
7
|
class Notification < Mosaic::Facebook::Api::ApiObject
|
@@ -7,7 +9,7 @@ module Mosaic
|
|
7
9
|
class << self
|
8
10
|
# send_email requires these parameters: to, subject, body, access_token
|
9
11
|
def send_email(options)
|
10
|
-
response = get("/method/notifications.sendEmail", options)
|
12
|
+
response = get("/method/notifications.sendEmail", :query => options)
|
11
13
|
raise Mosaic::Facebook::Error.new(response['error_response']) if response.include?('error_response')
|
12
14
|
response
|
13
15
|
end
|
@@ -5,23 +5,20 @@ module Mosaic
|
|
5
5
|
attr_accessor :id, :name, :access_token, :category
|
6
6
|
|
7
7
|
def insights
|
8
|
+
# requires read_insights permission
|
8
9
|
@insights ||= AssociationProxy.new(Mosaic::Facebook::Graph::Insights, "/#{self.id}/insights")
|
9
10
|
end
|
10
11
|
|
11
12
|
def posts
|
12
13
|
@posts ||= AssociationProxy.new(Mosaic::Facebook::Graph::Post, "/#{self.id}/posts")
|
13
14
|
end
|
14
|
-
|
15
|
-
def user
|
16
|
-
@user ||= AssociationProxy.new(Mosaic::Facebook::Graph::User, "/me")
|
17
|
-
end
|
18
15
|
|
19
16
|
class << self
|
20
17
|
def all(options = {})
|
21
18
|
# need 'manage_pages' extended permission to get pages (via accounts connection)
|
22
|
-
@all ||= find("
|
19
|
+
@all ||= find("/me/accounts", options)
|
23
20
|
end
|
24
|
-
|
21
|
+
|
25
22
|
def find_by_name(name, options = {})
|
26
23
|
all(options).find { |account| account.name == name }
|
27
24
|
end
|
@@ -1,12 +1,26 @@
|
|
1
|
+
require 'cgi'
|
2
|
+
|
1
3
|
module Mosaic
|
2
4
|
module Facebook
|
3
5
|
module Graph
|
4
6
|
class Application < Mosaic::Facebook::Graph::GraphObject
|
5
|
-
attr_accessor :id, :name, :link
|
7
|
+
attr_accessor :id, :name, :link, :secret
|
8
|
+
|
9
|
+
def access_token
|
10
|
+
@access_token ||= get_access_token
|
11
|
+
end
|
6
12
|
|
7
13
|
def subscriptions
|
14
|
+
# requires an application access token
|
8
15
|
@subscriptions ||= AssociationProxy.new(Mosaic::Facebook::Graph::Subscription, "/#{id}/subscriptions")
|
9
16
|
end
|
17
|
+
|
18
|
+
protected
|
19
|
+
|
20
|
+
def get_access_token
|
21
|
+
response = get('/oauth/access_token', :client_id => id, :client_secret => secret, :grant_type => 'client_credentials')
|
22
|
+
CGI.parse(response.body)['access_token'].first
|
23
|
+
end
|
10
24
|
end
|
11
25
|
end
|
12
26
|
end
|
@@ -10,6 +10,12 @@ module Mosaic
|
|
10
10
|
response
|
11
11
|
end
|
12
12
|
|
13
|
+
def get(path, options = {})
|
14
|
+
response = super(path, options)
|
15
|
+
raise Mosaic::Facebook::Error.new(response['error']) if !response.success?
|
16
|
+
response
|
17
|
+
end
|
18
|
+
|
13
19
|
def post(path, options = {})
|
14
20
|
response = super(path, options)
|
15
21
|
raise Mosaic::Facebook::Error.new(response['error']) if !response.success?
|
@@ -18,7 +24,7 @@ module Mosaic
|
|
18
24
|
|
19
25
|
class << self
|
20
26
|
def find(path, options = {})
|
21
|
-
response = get(path, options)
|
27
|
+
response = get(path, :query => options)
|
22
28
|
raise Mosaic::Facebook::Error.new(response['error']) if !response.success?
|
23
29
|
data = response.parsed_response
|
24
30
|
if data.include?('data')
|
@@ -10,10 +10,9 @@ module Mosaic
|
|
10
10
|
attributes.each { |key,value| instance_variable_set("@#{key}".to_sym, value) }
|
11
11
|
end
|
12
12
|
|
13
|
-
def
|
13
|
+
def get(path, options = {})
|
14
14
|
query = { :access_token => self.class.facebook_access_token }.merge(options)
|
15
|
-
|
16
|
-
self.class.delete path, :query => query, :body => serialize_body(body)
|
15
|
+
self.class.get path, :query => query
|
17
16
|
end
|
18
17
|
|
19
18
|
def post(path, options)
|
@@ -22,7 +21,6 @@ module Mosaic
|
|
22
21
|
self.class.post path, :query => query, :body => serialize_body(body)
|
23
22
|
end
|
24
23
|
|
25
|
-
|
26
24
|
class << self
|
27
25
|
def attr_name(*names)
|
28
26
|
self.attribute_names += names.collect(&:to_s)
|
@@ -53,14 +51,6 @@ module Mosaic
|
|
53
51
|
@facebook_access_token ||= configuration && configuration['access_token']
|
54
52
|
end
|
55
53
|
|
56
|
-
def facebook_user
|
57
|
-
@facebook_user ||= configuration['user']
|
58
|
-
end
|
59
|
-
|
60
|
-
def get(path, options)
|
61
|
-
super(path, :query => options)
|
62
|
-
end
|
63
|
-
|
64
54
|
private
|
65
55
|
def logger
|
66
56
|
@logger ||= if defined?(Rails)
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require File.expand_path('../../spec_helper.rb', __FILE__)
|
2
|
+
|
3
|
+
describe Mosaic::Facebook::Notification do
|
4
|
+
def options
|
5
|
+
options = {:recipients => "000000000", :subject => "testing", :text => "ajit", :access_token => "xxx"}
|
6
|
+
end
|
7
|
+
|
8
|
+
context "when no or invalid token is passed" do
|
9
|
+
it "should require an access_token" do
|
10
|
+
expect { Mosaic::Facebook::Notification.send_email(options.merge(:access_token => nil)) }.to raise_error(Mosaic::Facebook::AccessTokenError, /Invalid application ID/i)
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should require a valid access_token" do
|
14
|
+
expect { Mosaic::Facebook::Notification.send_email(options.merge(:recipients => RSpec.configuration.user_id)) }.to raise_error(Mosaic::Facebook::AccessTokenError, /INVALID OAUTH ACCESS TOKEN/i)
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
|
19
|
+
context "when a valid access_token is provided" do
|
20
|
+
it "should send a notification" do
|
21
|
+
expect { Mosaic::Facebook::Notification.send_email(options.merge(:recipients => RSpec.configuration.user_id, :access_token => RSpec.configuration.access_token)) }.to_not raise_error
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require File.expand_path('../../spec_helper.rb', __FILE__)
|
2
|
+
|
3
|
+
describe Mosaic::Facebook::Graph::Account do
|
4
|
+
context "self.all" do
|
5
|
+
it "should require an access token" do
|
6
|
+
expect { Mosaic::Facebook::Graph::Account.all }.to raise_error(Mosaic::Facebook::AccessTokenError)
|
7
|
+
end
|
8
|
+
|
9
|
+
context "when an access token is provided" do
|
10
|
+
it "should return the current user's apps and pages" do
|
11
|
+
# requires manage_pages permission
|
12
|
+
# TODO: update test suite to generate appropriate test users
|
13
|
+
accounts = Mosaic::Facebook::Graph::Account.all(:access_token => RSpec.configuration.access_token)
|
14
|
+
expect(accounts).to be_an_instance_of Array
|
15
|
+
expect(accounts.first).to be_an_instance_of Mosaic::Facebook::Graph::Account
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
context "self.find_by_name" do
|
21
|
+
it "should find an account for a named page" do
|
22
|
+
account = Mosaic::Facebook::Graph::Account.find_by_name('Mosaic (staging)', :access_token => RSpec.configuration.access_token)
|
23
|
+
expect(account).to be_an_instance_of Mosaic::Facebook::Graph::Account
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
context "given a known account" do
|
28
|
+
before(:all) do
|
29
|
+
@account = Mosaic::Facebook::Graph::Account.find_by_name('Mosaic (staging)', :access_token => RSpec.configuration.access_token)
|
30
|
+
end
|
31
|
+
|
32
|
+
it "should retrieve the insights" do
|
33
|
+
# requires read_insights permission
|
34
|
+
# TODO: update test suite to generate appropriate test users
|
35
|
+
insights = @account.insights.all(:access_token => RSpec.configuration.access_token)
|
36
|
+
expect(insights).to be_an_instance_of Array
|
37
|
+
expect(insights.first).to be_an_instance_of Mosaic::Facebook::Graph::Insights
|
38
|
+
end
|
39
|
+
|
40
|
+
it "should retrieve the posts" do
|
41
|
+
# FIXME: limit=3 work-around for facebook bug as per:
|
42
|
+
# https://developers.facebook.com/bugs/525301577527928?browse=search_516709daab5da1453067889
|
43
|
+
posts = @account.posts.all(:access_token => RSpec.configuration.access_token, :limit => 3)
|
44
|
+
expect(posts).to be_an_instance_of Array
|
45
|
+
expect(posts.first).to be_an_instance_of Mosaic::Facebook::Graph::Post
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require File.expand_path('../../spec_helper.rb', __FILE__)
|
2
|
+
|
3
|
+
describe Mosaic::Facebook::Graph::Application do
|
4
|
+
context "self.find_by_id" do
|
5
|
+
it "should require an access token" do
|
6
|
+
expect { Mosaic::Facebook::Graph::Application.find_by_id(RSpec.configuration.app_id) }.to raise_error(Mosaic::Facebook::Error, /unsupported get request/i)
|
7
|
+
end
|
8
|
+
|
9
|
+
context "with an access token" do
|
10
|
+
it "should find an application" do
|
11
|
+
application = Mosaic::Facebook::Graph::Application.find_by_id(RSpec.configuration.app_id, :access_token => RSpec.configuration.access_token)
|
12
|
+
expect(application).to be_an_instance_of(Mosaic::Facebook::Graph::Application)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
context "given an application (and a client secret)" do
|
18
|
+
before(:all) do
|
19
|
+
@application = Mosaic::Facebook::Graph::Application.new(:id => RSpec.configuration.app_id, :secret => RSpec.configuration.app_secret)
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should retrieve an access token" do
|
23
|
+
access_token = @application.access_token
|
24
|
+
expect(access_token).to be_an_instance_of String
|
25
|
+
end
|
26
|
+
|
27
|
+
it "should return a list of subscriptions" do
|
28
|
+
# requires an application access token
|
29
|
+
subscriptions = @application.subscriptions.all(:access_token => @application.access_token)
|
30
|
+
expect(subscriptions).to be_an_instance_of Array
|
31
|
+
# TODO: add subscription to test?
|
32
|
+
# expect(subscriptions.first).to be_an_instance_of Mosaic::Facebook::Graph::Subscription
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require File.expand_path('../../spec_helper.rb', __FILE__)
|
2
|
+
|
3
|
+
describe Mosaic::Facebook::Graph::Page do
|
4
|
+
context "given a valid page" do
|
5
|
+
before(:all) do
|
6
|
+
@page = Mosaic::Facebook::Graph::Page.new(:id => RSpec.configuration.page_id)
|
7
|
+
end
|
8
|
+
|
9
|
+
context "with a valid access token" do
|
10
|
+
it "should return a page feed" do
|
11
|
+
# FIXME: limit=3 work-around for facebook bug as per:
|
12
|
+
# https://developers.facebook.com/bugs/525301577527928?browse=search_516709daab5da1453067889
|
13
|
+
feed = @page.feed.all(:access_token => RSpec.configuration.access_token, :limit => 3)
|
14
|
+
expect(feed).to be_an_instance_of Array
|
15
|
+
expect(feed.first).to be_an_instance_of Mosaic::Facebook::Graph::Post
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should return a event list" do
|
19
|
+
events = @page.events.all(:access_token => RSpec.configuration.access_token)
|
20
|
+
expect(events).to be_an_instance_of Array
|
21
|
+
expect(events.first).to be_an_instance_of Mosaic::Facebook::Graph::Event
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require File.expand_path('../../spec_helper.rb', __FILE__)
|
2
|
+
|
3
|
+
describe Mosaic::Facebook::Graph::Post do
|
4
|
+
context "given a page with posts" do
|
5
|
+
before(:all) do
|
6
|
+
@page = Mosaic::Facebook::Graph::Page.new(:id => RSpec.configuration.page_id)
|
7
|
+
# FIXME: limit=10 work-around for facebook bug as per:
|
8
|
+
# https://developers.facebook.com/bugs/525301577527928?browse=search_516709daab5da1453067889
|
9
|
+
@posts = @page.feed.all(:access_token => RSpec.configuration.access_token, :limit => 10)
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should retrieve the user who posted it" do
|
13
|
+
post = @posts.first
|
14
|
+
expect(post.from.all).to be_an_instance_of Mosaic::Facebook::Graph::User
|
15
|
+
end
|
16
|
+
|
17
|
+
# FIXME: requires a comment to actually exist in the retrieved posts...
|
18
|
+
# maybe find a comment through another means first, and follow it to the post?
|
19
|
+
context "and a post with comments" do
|
20
|
+
before(:all) do
|
21
|
+
@post = @posts.find { |post| post.comments.all.any? }
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should retrieve the post's comments" do
|
25
|
+
comments = @post.comments.all
|
26
|
+
expect(comments).to be_an_instance_of Array
|
27
|
+
expect(comments.first).to be_an_instance_of Mosaic::Facebook::Graph::Comment
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require File.expand_path('../../spec_helper.rb', __FILE__)
|
2
|
+
|
3
|
+
describe Mosaic::Facebook::Graph::User do
|
4
|
+
context "self.me" do
|
5
|
+
it "should require an access token" do
|
6
|
+
expect { Mosaic::Facebook::Graph::User.me }.to raise_error(Mosaic::Facebook::AccessTokenError)
|
7
|
+
end
|
8
|
+
|
9
|
+
context "when an access token is provided" do
|
10
|
+
it "should return the current user" do
|
11
|
+
me = Mosaic::Facebook::Graph::User.me(:access_token => RSpec.configuration.access_token)
|
12
|
+
expect(me).to be_an_instance_of Mosaic::Facebook::Graph::User
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
context "given a valid user" do
|
18
|
+
before(:all) do
|
19
|
+
@me = Mosaic::Facebook::Graph::User.new(:id => 'me')
|
20
|
+
end
|
21
|
+
|
22
|
+
context "#accounts" do
|
23
|
+
it "should require an access token" do
|
24
|
+
expect { @me.accounts.all }.to raise_error(Mosaic::Facebook::AccessTokenError)
|
25
|
+
end
|
26
|
+
|
27
|
+
context "when a valid access token is provided" do
|
28
|
+
# requires manage_pages permission
|
29
|
+
# TODO: update test suite to generate appropriate test users
|
30
|
+
it "should return the user's apps and pages" do
|
31
|
+
accounts = @me.accounts.all(:access_token => RSpec.configuration.access_token)
|
32
|
+
expect(accounts).to be_an_instance_of Array
|
33
|
+
expect(accounts.first).to be_an_instance_of Mosaic::Facebook::Graph::Account
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
data/spec/spec.opts
CHANGED
@@ -1,3 +1,3 @@
|
|
1
1
|
--colour
|
2
|
-
|
3
|
-
--
|
2
|
+
#--format documentation
|
3
|
+
--format progress
|
data/spec/spec_helper.rb
CHANGED
@@ -17,4 +17,6 @@ RSpec.configure do |config|
|
|
17
17
|
config.add_setting :access_token, :default => FACEBOOK_CONFIG["access_token"]
|
18
18
|
config.add_setting :user_id, :default => FACEBOOK_CONFIG["user_id"]
|
19
19
|
config.add_setting :page_id, :default => FACEBOOK_CONFIG["page_id"]
|
20
|
+
config.add_setting :app_id, :default => FACEBOOK_CONFIG["app_id"]
|
21
|
+
config.add_setting :app_secret, :default => FACEBOOK_CONFIG["app_secret"]
|
20
22
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mosaic-facebook
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -99,9 +99,19 @@ files:
|
|
99
99
|
- lib/mosaic/facebook/version.rb
|
100
100
|
- lib/mosaic_facebook.rb
|
101
101
|
- mosaic-facebook.gemspec
|
102
|
+
- spec/api/notification_spec.rb
|
102
103
|
- spec/facebook_config.yml.example
|
103
|
-
- spec/
|
104
|
-
- spec/
|
104
|
+
- spec/fql/comment_spec.rb
|
105
|
+
- spec/fql/post_spec.rb
|
106
|
+
- spec/graph/account_spec.rb
|
107
|
+
- spec/graph/application_spec.rb
|
108
|
+
- spec/graph/comment_spec.rb
|
109
|
+
- spec/graph/event_spec.rb
|
110
|
+
- spec/graph/insights_spec.rb
|
111
|
+
- spec/graph/page_spec.rb
|
112
|
+
- spec/graph/post_spec.rb
|
113
|
+
- spec/graph/subscription_spec.rb
|
114
|
+
- spec/graph/user_spec.rb
|
105
115
|
- spec/mosaic-facebook_spec.rb
|
106
116
|
- spec/spec.opts
|
107
117
|
- spec/spec_helper.rb
|
@@ -130,9 +140,19 @@ signing_key:
|
|
130
140
|
specification_version: 3
|
131
141
|
summary: gem/plugin to connect to facebook graph api
|
132
142
|
test_files:
|
143
|
+
- spec/api/notification_spec.rb
|
133
144
|
- spec/facebook_config.yml.example
|
134
|
-
- spec/
|
135
|
-
- spec/
|
145
|
+
- spec/fql/comment_spec.rb
|
146
|
+
- spec/fql/post_spec.rb
|
147
|
+
- spec/graph/account_spec.rb
|
148
|
+
- spec/graph/application_spec.rb
|
149
|
+
- spec/graph/comment_spec.rb
|
150
|
+
- spec/graph/event_spec.rb
|
151
|
+
- spec/graph/insights_spec.rb
|
152
|
+
- spec/graph/page_spec.rb
|
153
|
+
- spec/graph/post_spec.rb
|
154
|
+
- spec/graph/subscription_spec.rb
|
155
|
+
- spec/graph/user_spec.rb
|
136
156
|
- spec/mosaic-facebook_spec.rb
|
137
157
|
- spec/spec.opts
|
138
158
|
- spec/spec_helper.rb
|
@@ -1,25 +0,0 @@
|
|
1
|
-
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper.rb'))
|
2
|
-
|
3
|
-
|
4
|
-
describe Mosaic::Facebook::Notification do
|
5
|
-
def options
|
6
|
-
options = {:recipients => "000000000", :subject => "testing", :text => "ajit", :access_token => "xxx"}
|
7
|
-
end
|
8
|
-
|
9
|
-
context "when no or invalid token is passed" do
|
10
|
-
it "should require an access_token" do
|
11
|
-
lambda { Mosaic::Facebook::Notification.send_email(options.merge(:access_token => nil)) }.should raise_error(Mosaic::Facebook::AccessTokenError, /Invalid application ID/i)
|
12
|
-
end
|
13
|
-
|
14
|
-
it "should require a valid access_token" do
|
15
|
-
lambda {Mosaic::Facebook::Notification.send_email(options.merge(:recipients => RSpec.configuration.user_id))}.should raise_error(Mosaic::Facebook::AccessTokenError, /INVALID OAUTH ACCESS TOKEN/i)
|
16
|
-
end
|
17
|
-
|
18
|
-
end
|
19
|
-
|
20
|
-
context "when a valid access_token is provided" do
|
21
|
-
it "should send a notification" do
|
22
|
-
Mosaic::Facebook::Notification.send_email(options.merge(:recipients => RSpec.configuration.user_id, :access_token => RSpec.configuration.access_token))
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper.rb'))
|
2
|
-
|
3
|
-
describe Mosaic::Facebook::Graph::Page do
|
4
|
-
context "when a valid token and page id are passed" do
|
5
|
-
it "should return a page feed" do
|
6
|
-
feed = Mosaic::Facebook::Graph::Page.new().feed.all({ :access_token => RSpec.configuration.access_token, :id => RSpec.configuration.page_id })
|
7
|
-
feed.should be_an_instance_of Array
|
8
|
-
feed.first.should be_an_instance_of Mosaic::Facebook::Graph::Post
|
9
|
-
end
|
10
|
-
|
11
|
-
it "should return a event list" do
|
12
|
-
events = Mosaic::Facebook::Graph::Page.new().events.all({ :access_token => RSpec.configuration.access_token, :id => RSpec.configuration.page_id })
|
13
|
-
events.should be_an_instance_of Array
|
14
|
-
events.first.should be_an_instance_of Mosaic::Facebook::Graph::Event
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|