Skip to content

Commit

Permalink
change "users_votes" connection method to "votes"
Browse files Browse the repository at this point in the history
change "votes" attribute to "vote_count"
  • Loading branch information
nov committed Nov 9, 2011
1 parent 0f5ea94 commit b9fd3fe
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/fb_graph/connections/votes.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module FbGraph
module Connections
module Votes
def users_votes(options = {})
def votes(options = {})
self.connection(:votes, options)
end
end
Expand Down
4 changes: 2 additions & 2 deletions lib/fb_graph/question_option.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ module FbGraph
class QuestionOption < Node
include Connections::Votes

attr_accessor :from, :name, :votes, :object, :created_time
attr_accessor :from, :name, :vote_count, :object, :created_time

def initialize(identifier, attributes = {})
super
@from = if attributes[:from]
User.new(attributes[:from][:id], attributes[:from])
end
@name = attributes[:name]
@votes = attributes[:votes]
@vote_count = attributes[:votes]
@object = if attributes[:object]
Page.new(attributes[:object][:id], attributes[:object])
end
Expand Down
4 changes: 2 additions & 2 deletions spec/fb_graph/connections/votes_spec.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
require 'spec_helper'

describe FbGraph::Connections::Votes, '#users_votes' do
describe FbGraph::Connections::Votes, '#votes' do
context 'when included by FbGraph::QuestionOption' do
it 'should return votes with user id and name' do
mock_graph :get, '12345/votes', 'questions/options/votes/matake_private', :access_token => 'access_token' do
votes = FbGraph::QuestionOption.new('12345', :access_token => 'access_token').users_votes
votes = FbGraph::QuestionOption.new('12345', :access_token => 'access_token').votes
votes.each do |vote|
vote["id"].should_not be_blank
vote["name"].should_not be_blank
Expand Down
2 changes: 1 addition & 1 deletion spec/fb_graph/qeustion_option_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
question.identifier.should == '12345'
question.from.should == FbGraph::User.new('23456', :name => 'Mahmoud Khaled')
question.name.should == 'option 1'
question.votes.should == 5
question.vote_count.should == 5
question.object.should be_instance_of(FbGraph::Page)
question.object.name.should == "Ruby programming language"
question.object.category.should == "Interest"
Expand Down

0 comments on commit b9fd3fe

Please sign in to comment.