test/facebooker/rails/publisher_test.rb in facebooker-1.0.48 vs test/facebooker/rails/publisher_test.rb in facebooker-1.0.50
- old
+ new
@@ -135,10 +135,27 @@
def invalid_send_as(to)
send_as :fake
recipients to
end
+ def publish_post_to_own_stream(user)
+ send_as :publish_stream
+ from user
+ target user
+ attachment({:name => "Facebooker", :href => "http://www.exampple.com"})
+ message "Posting post to own stream"
+ action_links([{:text => "Action Link", :href => "http://www.example.com/action_link"}])
+ end
+
+ def publish_post_to_friends_stream(from, to)
+ send_as :publish_stream
+ from from
+ target to
+ attachment({:name => "Facebooker", :href => "http://www.exampple.com"})
+ message "Posting post to friends stream"
+ action_links([{:text => "Action Link", :href => "http://www.example.com/action_link"}])
+ end
end
class Facebooker::Rails::Publisher::FacebookTemplateTest < Test::Unit::TestCase
FacebookTemplate = Facebooker::Rails::Publisher::FacebookTemplate
@@ -411,9 +428,23 @@
assert_raises(Facebooker::Rails::Publisher::UnknownBodyType) {
TestPublisher.deliver_invalid_send_as(@user)
}
end
+ def test_publish_post_to_own_stream
+ @user = Facebooker::User.new
+ @user.expects(:publish_to).with(@user, has_entry(:attachment=>instance_of(Hash)))
+
+ TestPublisher.deliver_publish_post_to_own_stream(@user)
+ end
+
+ def test_publish_post_to_friends_stream
+ @from_user = Facebooker::User.new
+ @to_user = Facebooker::User.new
+ @from_user.expects(:publish_to).with(@to_user, has_entry(:action_links=>instance_of(Array)))
+
+ TestPublisher.deliver_publish_post_to_friends_stream(@from_user, @to_user)
+ end
def test_keeps_class_method_missing
assert_raises(NoMethodError) {
TestPublisher.fake
}