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.1.2 spec/fb_graph/connections/subscriptions_spec.rb
fb_graph-2.1.1 spec/fb_graph/connections/subscriptions_spec.rb
fb_graph-2.1.0 spec/fb_graph/connections/subscriptions_spec.rb
fb_graph-2.1.0.alpha spec/fb_graph/connections/subscriptions_spec.rb
fb_graph-2.0.2 spec/fb_graph/connections/subscriptions_spec.rb
fb_graph-2.0.1 spec/fb_graph/connections/subscriptions_spec.rb
fb_graph-2.0.0 spec/fb_graph/connections/subscriptions_spec.rb
fb_graph-2.0.0.beta spec/fb_graph/connections/subscriptions_spec.rb
fb_graph-2.0.0.alpha spec/fb_graph/connections/subscriptions_spec.rb
fb_graph-1.9.5 spec/fb_graph/connections/subscriptions_spec.rb
fb_graph-1.9.4 spec/fb_graph/connections/subscriptions_spec.rb
fb_graph-1.9.3 spec/fb_graph/connections/subscriptions_spec.rb
fb_graph-1.9.2 spec/fb_graph/connections/subscriptions_spec.rb
fb_graph-1.9.1 spec/fb_graph/connections/subscriptions_spec.rb
fb_graph-1.9.0 spec/fb_graph/connections/subscriptions_spec.rb
fb_graph-1.8.6 spec/fb_graph/connections/subscriptions_spec.rb
fb_graph-1.8.5 spec/fb_graph/connections/subscriptions_spec.rb
fb_graph-1.8.4 spec/fb_graph/connections/subscriptions_spec.rb
fb_graph-1.8.3 spec/fb_graph/connections/subscriptions_spec.rb
fb_graph-1.8.2 spec/fb_graph/connections/subscriptions_spec.rb