Sha256: 088e34382938c87f9c8676be1b93ae17352606b0bba5d44051663ca0ad564c2d

Contents?: true

Size: 1.89 KB

Versions: 25

Compression:

Stored size: 1.89 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/../../test_helper')
require 'active_support'

class Facebooker::PageTest < Test::Unit::TestCase

  def setup
    super
    Facebooker::Session.current = mock("session")
  end

  def test_should_be_able_to_populate_with_photo_id_as_integer
    p = Facebooker::Page.new(12345)
    assert_equal(12345,p.page_id)
  end
  
  def test_should_be_able_to_initialize_with_photo_id_as_string
    p = Facebooker::Page.new("12345")
    assert_equal("12345",p.page_id)    
  end
  
  def test_should_alias_photo_id_as_id
    p = Facebooker::Page.new("12345")
    assert_equal("12345", p.id)    
  end
  
  def test_should_be_able_to_initialize_with_hash
    p = Facebooker::Page.new(:page_id=>12345,:name=>"test page")
    assert_equal("test page",p.name)
    assert_equal(12345,p.page_id)
  end
  
  def test_should_be_able_to_see_if_user_is_fan_with_id
    Facebooker::Session.current.expects(:post).with("facebook.pages.isFan",:page_id=>12345,:uid=>12451752).returns(true)
    p = Facebooker::Page.new(12345)
    assert p.user_is_fan?(12451752)
  end
  
  def test_should_be_able_to_see_if_user_is_fan_with_user
    Facebooker::Session.current.expects(:post).with("facebook.pages.isFan",:page_id=>12345,:uid=>12451752).returns(false)
    p = Facebooker::Page.new(12345)
    assert !p.user_is_fan?(Facebooker::User.new(12451752))
  end
  
  def test_should_be_able_to_see_if_user_is_admin_with_id
    Facebooker::Session.current.expects(:post).with("facebook.pages.isAdmin",:page_id=>12345,:uid=>12451752).returns(false)
    p = Facebooker::Page.new(12345)
    assert !p.user_is_admin?(12451752)
    
  end
  
  def test_should_be_able_to_see_if_user_is_admin_with_user
    Facebooker::Session.current.expects(:post).with("facebook.pages.isAdmin",:page_id=>12345,:uid=>12451752).returns(true)
    p = Facebooker::Page.new(12345)
    assert p.user_is_admin?(Facebooker::User.new(12451752))
  end
end

Version data entries

25 entries across 25 versions & 8 rubygems

Version Path
facebooker-1.0.75 test/facebooker/models/page_test.rb
sentientmonkey-facebooker-1.0.74 test/facebooker/models/page_test.rb
facebooker-micah-1.0.74 test/facebooker/models/page_test.rb
facebooker-1.0.74 test/facebooker/models/page_test.rb
facebooker-1.0.73 test/facebooker/models/page_test.rb
facebooker-1.0.72 test/facebooker/models/page_test.rb
facebooker-1.0.71 test/facebooker/models/page_test.rb
facebooker-1.0.70 test/facebooker/models/page_test.rb
benhutton-facebooker-1.0.69.2 test/facebooker/models/page_test.rb
benhutton-facebooker-1.0.69.1 test/facebooker/models/page_test.rb
facebooker-1.0.69 test/facebooker/models/page_test.rb
cbaclig-facebooker-1.0.67.3 test/facebooker/models/page_test.rb
facebooker-1.0.68 test/facebooker/models/page_test.rb
cbaclig-facebooker-1.0.67.2 test/facebooker/models/page_test.rb
facebooker-lite-1.0.67.2 test/facebooker/models/page_test.rb
facebooker-lite-1.0.67.1 test/facebooker/models/page_test.rb
facebooker-lite-1.0.67 test/facebooker/models/page_test.rb
fotonauts-facebooker-1.0.67 test/facebooker/models/page_test.rb
facebooker-1.0.67 test/facebooker/models/page_test.rb
facebooker-1.0.66 test/facebooker/models/page_test.rb