Sha256: 2bde2133885398d8e256adaa165cb4c6a5d932f7053ce4e0d3baefb169b30051

Contents?: true

Size: 1.54 KB

Versions: 104

Compression:

Stored size: 1.54 KB

Contents

require 'spec_helper'

describe FbGraph::Connections::Subscriptions, '#subscriptions' do
  context 'when included by FbGraph::Application' do
    context 'when access_token is given' do
      it 'should return liked pages as FbGraph::Page' do
        mock_graph :get, 'fb_graph/subscriptions', 'applications/subscriptions/fb_graph_private', :access_token => 'access_token' do
          subscriptions = FbGraph::Application.new('fb_graph', :access_token => 'access_token').subscriptions
          subscriptions.each do |subscription|
            subscription.should be_instance_of(FbGraph::Subscription)
          end
        end
      end
    end
  end
end

describe FbGraph::Connections::Subscriptions, '#subscribe!' do
  before do
    @app = FbGraph::Application.new('fb_graph', :access_token => 'access_token')
  end

  it 'should POST to /:app_id/subscriptions' do
    lambda do
      @app.subscribe!(
        :object => "user",
        :fields => "name,email",
        :callback_url => "http://fbgraphsample.heroku.com/subscription",
        :verify_token => "Define by yourself"
      )
    end.should request_to 'fb_graph/subscriptions', :post
  end
end

describe FbGraph::Connections::Subscriptions, '#unsubscribe!' do
  before do
    @app = FbGraph::Application.new('fb_graph', :access_token => 'access_token')
  end

  it 'should DELETE /:app_id/subscriptions' do
    mock_graph :delete, 'fb_graph/subscriptions', 'true', :params => {:object => 'user'}, :access_token => 'access_token' do
      @app.unsubscribe!(
        :object => 'user'
      )
    end
  end
end

Version data entries

104 entries across 104 versions & 1 rubygems

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