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.6.5 spec/fb_graph/connections/user_achievements_spec.rb
fb_graph-2.6.4 spec/fb_graph/connections/user_achievements_spec.rb
fb_graph-2.6.3 spec/fb_graph/connections/user_achievements_spec.rb
fb_graph-2.6.2 spec/fb_graph/connections/user_achievements_spec.rb
fb_graph-2.6.1 spec/fb_graph/connections/user_achievements_spec.rb
fb_graph-2.6.0 spec/fb_graph/connections/user_achievements_spec.rb
fb_graph-2.5.9 spec/fb_graph/connections/user_achievements_spec.rb
fb_graph-2.5.8 spec/fb_graph/connections/user_achievements_spec.rb
fb_graph-2.5.7 spec/fb_graph/connections/user_achievements_spec.rb
fb_graph-2.5.6 spec/fb_graph/connections/user_achievements_spec.rb
fb_graph-2.5.5 spec/fb_graph/connections/user_achievements_spec.rb
fb_graph-2.5.4 spec/fb_graph/connections/user_achievements_spec.rb
fb_graph-2.5.3 spec/fb_graph/connections/user_achievements_spec.rb
fb_graph-2.5.2 spec/fb_graph/connections/user_achievements_spec.rb
fb_graph-2.5.1 spec/fb_graph/connections/user_achievements_spec.rb
fb_graph-2.5.0 spec/fb_graph/connections/user_achievements_spec.rb
fb_graph-2.4.20 spec/fb_graph/connections/user_achievements_spec.rb
fb_graph-2.4.19 spec/fb_graph/connections/user_achievements_spec.rb
fb_graph-2.4.18 spec/fb_graph/connections/user_achievements_spec.rb
fb_graph-2.4.17 spec/fb_graph/connections/user_achievements_spec.rb