Sha256: 1284cefa4e45412323d8c909a67100c6abdaa9b5cc5f5ff3b6a2ff17111f55e6

Contents?: true

Size: 1.91 KB

Versions: 59

Compression:

Stored size: 1.91 KB

Contents

require 'spec_helper'

describe FbGraph::Notification do
  let :attributes do
    {
      :id => 'notif_579612276_139149416',
      :title => 'Nobuhiro Nakajima commented on your status.',
      :message => 'Actual Comment Here',
      :link => 'http://www.facebook.com/matake/posts/10150574049082277',
      :unread => 0,
      :application => {
        :id => '19675640871',
        :name => 'Feed Comments'
      },
      :from => {
        :id => '1260873121',
        :name => 'Nobuhiro Nakajima'
      },
      :to => {
        :id => '579612276',
        :name => 'Nov Matake'
      },
      :created_time => '2012-01-25T04:01:09+0000',
      :updated_time => '2012-01-25T04:01:20+0000'
    }
  end

  it 'should setup all supported attributes' do
    notification = FbGraph::Notification.new(attributes[:id], attributes)
    notification.identifier.should == attributes[:id]
    notification.title.should      == attributes[:title]
    notification.message.should    == attributes[:message]
    notification.link.should       == attributes[:link]
    notification.unread.should be_false
    notification.application.should == FbGraph::Application.new(
      attributes[:application][:id], attributes[:application]
    )
    notification.from.should == FbGraph::User.new(
      attributes[:from][:id], attributes[:from]
    )
    notification.to.should == FbGraph::User.new(
      attributes[:to][:id], attributes[:to]
    )
    notification.created_time.should == Time.parse('2012-01-25T04:01:09+0000')
    notification.updated_time.should == Time.parse('2012-01-25T04:01:20+0000')
  end

  describe '#read!' do
    it 'should update unread to read' do
      mock_graph :post, 'notification_id', 'true', :params => {
        :unread => 'false'
      }, :access_token => 'access_token' do
        FbGraph::Notification.new('notification_id').read!(
          :access_token => 'access_token'
        ).should be_true
      end
    end
  end
end

Version data entries

59 entries across 59 versions & 1 rubygems

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