forked from nov/fb_graph
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add scores specs and remove "type" attributes nov#124
- Loading branch information
Showing
4 changed files
with
57 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
PATH | ||
remote: . | ||
specs: | ||
fb_graph (2.2.2) | ||
fb_graph (2.2.3) | ||
httpclient (>= 2.2.0.2) | ||
rack-oauth2 (>= 0.9.4) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
require 'spec_helper' | ||
|
||
describe FbGraph::Connections::Scores do | ||
let(:user) { FbGraph::User.new('matake', :access_token => 'user_access_token') } | ||
let(:app) { FbGraph::Application.new('FbGraph', :access_token => 'app_access_token') } | ||
|
||
describe '#scores' do | ||
it 'should return an Array of Score' do | ||
mock_graph :get, 'matake/scores', 'users/scores/sample', :access_token => 'user_access_token' do | ||
scores = user.scores | ||
scores.should be_a Array | ||
scores.should_not be_blank | ||
scores.each do |score| | ||
score.should be_instance_of FbGraph::Score | ||
score.user.should be_instance_of FbGraph::User | ||
score.application.should be_instance_of FbGraph::Application | ||
score.score.should be_a Integer | ||
end | ||
end | ||
end | ||
end | ||
|
||
describe '#score!' do | ||
it 'should return true' do | ||
mock_graph :post, 'matake/scores', 'true', :access_token => 'app_access_token', :params => { | ||
:score => '10' | ||
} do | ||
user.score!(10, :access_token => app.access_token).should be_true | ||
end | ||
end | ||
end | ||
|
||
describe '#unscore!' do | ||
it 'should return true' do | ||
mock_graph :delete, 'matake/scores', 'true', :access_token => 'app_access_token' do | ||
user.unscore!(:access_token => app.access_token).should be_true | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"data": [{ | ||
"user": { | ||
"name": "Nov Matake", | ||
"id": "579612276" | ||
}, | ||
"score": 10, | ||
"application": { | ||
"name": "gem sample", | ||
"canvas_name": "fbgraphsample", | ||
"namespace": "fbgraphsample", | ||
"id": "134145643294322" | ||
} | ||
}] | ||
} |