Sha256: 3e236da73cc0be612633301ecb67c01886186d59175087c8394cc437d5b10a45

Contents?: true

Size: 1.3 KB

Versions: 75

Compression:

Stored size: 1.3 KB

Contents

require 'spec_helper'

describe FbGraph::Connections::UserAchievements do
  let(:user) { FbGraph::User.new('matake', :access_token => 'access_token') }

  describe '#achievements' do
    it 'should return an Array of FbGraph::UserAchievement' do
      mock_graph :get, 'matake/achievements', 'users/user_achievements/sample', :access_token => 'access_token' do
        user.achievements.each do |achievement|
          achievement.should be_instance_of FbGraph::UserAchievement
        end
      end
    end
  end

  describe '#achieve!' do
    let(:achievement_url) { 'http://fbgraphsample.heroku.com/achievements/1' }
    it 'should return FbGraph::UserAchievement' do
      mock_graph :post, 'matake/achievements', 'users/user_achievements/created', :access_token => 'access_token', :params => {
        :achievement => achievement_url
      } do
        user.achieve!(achievement_url).should be_instance_of FbGraph::UserAchievement
      end
    end
  end

  describe '#unachieve!' do
    let(:achievement_url) { 'http://fbgraphsample.heroku.com/achievements/1' }
    it 'should return true' do
      mock_graph :delete, 'matake/achievements', 'true', :access_token => 'access_token', :params => {
        :achievement => achievement_url
      } do
        user.unachieve!(achievement_url).should be_true
      end
    end
  end
end

Version data entries

75 entries across 75 versions & 1 rubygems

Version Path
fb_graph-2.7.17 spec/fb_graph/connections/user_achievements_spec.rb
fb_graph-2.7.16 spec/fb_graph/connections/user_achievements_spec.rb
fb_graph-2.7.15 spec/fb_graph/connections/user_achievements_spec.rb
fb_graph-2.7.14 spec/fb_graph/connections/user_achievements_spec.rb
fb_graph-2.7.13 spec/fb_graph/connections/user_achievements_spec.rb
fb_graph-2.7.12 spec/fb_graph/connections/user_achievements_spec.rb
fb_graph-2.7.11 spec/fb_graph/connections/user_achievements_spec.rb
fb_graph-2.7.10 spec/fb_graph/connections/user_achievements_spec.rb
fb_graph-2.7.9 spec/fb_graph/connections/user_achievements_spec.rb
fb_graph-2.7.8 spec/fb_graph/connections/user_achievements_spec.rb
fb_graph-2.7.7 spec/fb_graph/connections/user_achievements_spec.rb
fb_graph-2.7.6 spec/fb_graph/connections/user_achievements_spec.rb
fb_graph-2.7.5 spec/fb_graph/connections/user_achievements_spec.rb
fb_graph-2.7.4 spec/fb_graph/connections/user_achievements_spec.rb
fb_graph-2.7.3 spec/fb_graph/connections/user_achievements_spec.rb
fb_graph-2.7.2 spec/fb_graph/connections/user_achievements_spec.rb
fb_graph-2.7.1 spec/fb_graph/connections/user_achievements_spec.rb
fb_graph-2.7.0 spec/fb_graph/connections/user_achievements_spec.rb
fb_graph-2.6.7 spec/fb_graph/connections/user_achievements_spec.rb
fb_graph-2.6.6 spec/fb_graph/connections/user_achievements_spec.rb