Sha256: 2b024ee491ac83f8a5728cace44265adebdfa2fcd0bfa0e04119f99e86e7bd77

Contents?: true

Size: 1.33 KB

Versions: 42

Compression:

Stored size: 1.33 KB

Contents

require 'spec_helper'

describe FbGraph::Connections::Attending do
  let(:event) do
    FbGraph::Event.new('smartday', :access_token => 'access_token')
  end

  describe '#attending' do
    it 'should return attending users as FbGraph::User' do
      mock_graph :get, 'smartday/attending', 'events/attending/smartday_private', :access_token => 'access_token' do
        event.attending.each do |user|
          user.should be_instance_of(FbGraph::User)
        end
      end
    end
  end

  describe '#attending?' do
    context 'when attending' do
      it 'should return true' do
        mock_graph :get, 'smartday/attending/uid', 'events/invited/attending', :access_token => 'access_token' do
          event.attending?(
            FbGraph::User.new('uid')
          ).should be_true
        end
      end
    end

    context 'otherwise' do
      it 'should return false' do
        mock_graph :get, 'smartday/attending/uid', 'empty', :access_token => 'access_token' do
          event.attending?(
            FbGraph::User.new('uid')
          ).should be_false
        end
      end
    end
  end

  describe '#attend!' do
    it 'should return true' do
      mock_graph :post, 'smartday/attending', 'events/attending/post_with_valid_access_token', :access_token => 'access_token' do
        event.attend!.should be_true
      end
    end
  end
end

Version data entries

42 entries across 42 versions & 1 rubygems

Version Path
fb_graph-2.6.5 spec/fb_graph/connections/attending_spec.rb
fb_graph-2.6.4 spec/fb_graph/connections/attending_spec.rb
fb_graph-2.6.3 spec/fb_graph/connections/attending_spec.rb
fb_graph-2.6.2 spec/fb_graph/connections/attending_spec.rb
fb_graph-2.6.1 spec/fb_graph/connections/attending_spec.rb
fb_graph-2.6.0 spec/fb_graph/connections/attending_spec.rb
fb_graph-2.5.9 spec/fb_graph/connections/attending_spec.rb
fb_graph-2.5.8 spec/fb_graph/connections/attending_spec.rb
fb_graph-2.5.7 spec/fb_graph/connections/attending_spec.rb
fb_graph-2.5.6 spec/fb_graph/connections/attending_spec.rb
fb_graph-2.5.5 spec/fb_graph/connections/attending_spec.rb
fb_graph-2.5.4 spec/fb_graph/connections/attending_spec.rb
fb_graph-2.5.3 spec/fb_graph/connections/attending_spec.rb
fb_graph-2.5.2 spec/fb_graph/connections/attending_spec.rb
fb_graph-2.5.1 spec/fb_graph/connections/attending_spec.rb
fb_graph-2.5.0 spec/fb_graph/connections/attending_spec.rb
fb_graph-2.4.20 spec/fb_graph/connections/attending_spec.rb
fb_graph-2.4.19 spec/fb_graph/connections/attending_spec.rb
fb_graph-2.4.18 spec/fb_graph/connections/attending_spec.rb
fb_graph-2.4.17 spec/fb_graph/connections/attending_spec.rb