Sha256: f5dae945a8cc9c648e69ce8a585f4a82dce53d4735c447083cc3617131a121d4

Contents?: true

Size: 1.58 KB

Versions: 39

Compression:

Stored size: 1.58 KB

Contents

require 'spec_helper'

describe FbGraph::UserAchievement do
  subject { achievement }
  let(:achievement) { FbGraph::UserAchievement.new(attributes[:id], attributes) }
  let(:attributes) do
    {
      :id => "10150351898227277",
      :from => {
        :id => "10150351898227277",
        :name => "Nov Matake"
      },
      :start_time => "2011-09-27T14:18:33+0000",
      :end_time => "2011-09-27T14:18:33+0000",
      :publish_time => "2011-09-27T14:18:33+0000",
      :application => {
        :id => "134145643294322",
        :name => "gem sample"
      },
      :achievement => {
        :id => "10150310611431721",
        :url => "http:\/\/fbgraphsample.heroku.com\/achievements\/1",
        :type => "game.achievement",
        :title => "1st Achievement"
      },
      :likes => {
        :count => 0
      },
      :comments => {
        :count => 0
      }
    }
  end

  its(:from) { should be_a FbGraph::User }
  its(:achievement) { should be_a FbGraph::Achievement }
  its(:application) { should be_a FbGraph::Application }
  its(:created_time) { should == Time.parse(attributes[:publish_time]).utc }

  describe '#destroy' do
    it 'should call DELETE /:app_id/achievements' do
      expect { achievement.destroy }.to request_to('10150351898227277/achievements', :delete)
    end

    it 'should delete achievement' do
      mock_graph :delete, '10150351898227277/achievements', 'true', :access_token => 'app_token', :params => {
        :achievement => achievement.achievement.url
      } do
        achievement.destroy(:access_token => 'app_token').should be_true
      end
    end
  end
end

Version data entries

39 entries across 39 versions & 1 rubygems

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