Sha256: 8e85fa9e8221fc4c25e08b8abd9724748f5acba79b48e5f3651673a8910a00ba

Contents?: true

Size: 1.7 KB

Versions: 35

Compression:

Stored size: 1.7 KB

Contents

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

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

  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_ble_to_initialize_with_photo_id_as_string
    p = Facebooker::Page.new("12345")
    assert_equal("12345",p.page_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

35 entries across 35 versions & 9 rubygems

Version Path
micahwedemeyer-facebooker-1.0.50 test/facebooker/models/page_test.rb
micahwedemeyer-facebooker-1.0.51 test/facebooker/models/page_test.rb
mmangino-facebooker-1.0.41 test/facebooker/models/page_test.rb
mmangino-facebooker-1.0.42 test/facebooker/models/page_test.rb
mmangino-facebooker-1.0.43 test/facebooker/models/page_test.rb
mmangino-facebooker-1.0.44 test/facebooker/models/page_test.rb
mmangino-facebooker-1.0.45 test/facebooker/models/page_test.rb
mmangino-facebooker-1.0.46 test/facebooker/models/page_test.rb
mmangino-facebooker-1.0.47 test/facebooker/models/page_test.rb
mmangino-facebooker-1.0.48 test/facebooker/models/page_test.rb
mmangino-facebooker-1.0.49 test/facebooker/models/page_test.rb
mmangino-facebooker-1.0.50 test/facebooker/models/page_test.rb
pomartel-facebooker-1.0.45 test/facebooker/models/page_test.rb
pomartel-facebooker-1.0.47 test/facebooker/models/page_test.rb
simianarmy-facebooker-1.0.50 test/facebooker/models/page_test.rb
simianarmy-facebooker-1.0.51 test/facebooker/models/page_test.rb
taweili-facebooker-1.0.41 test/facebooker/models/page_test.rb
taweili-facebooker-1.0.45 test/facebooker/models/page_test.rb
taweili-facebooker-1.0.47 test/facebooker/models/page_test.rb
taweili-facebooker-1.0.50 test/facebooker/models/page_test.rb