Skip to content
Extraits de code Groupes Projets
dispatching_spec.rb 1,22 ko
Newer Older
  • Learn to ignore specific revisions
  • require "spec_helper"
    
    describe "Dispatching", type: :request do
    
      context "a comment retraction on a public post" do
    
        it "triggers a public dispatch" do
          # Alice has a public post and comments on it
          post = FactoryGirl.create(:status_message, public: true, author: alice.person)
    
          comment = alice.comment!(post, "awesomesauseum")
    
          inlined_jobs do
            # Alice now retracts her comment
            expect(Diaspora::Federation::Dispatcher::Public).to receive(:new).and_return(double(dispatch: true))
            expect(Diaspora::Federation::Dispatcher::Private).not_to receive(:new)
            alice.retract(comment)
          end
        end
      end
    
      context "a comment retraction on a private post" do
        it "triggers a private dispatch" do
          # Alice has a private post and comments on it
          post = alice.post(:status_message, text: "hello", to: alice.aspects.first)
    
          comment = alice.comment!(post, "awesomesauseum")
    
    Jonne Haß's avatar
    Jonne Haß a validé
          inlined_jobs do
    
            # Alice now retracts her comment
            expect(Diaspora::Federation::Dispatcher::Public).not_to receive(:new)
            expect(Diaspora::Federation::Dispatcher::Private).to receive(:new).and_return(double(dispatch: true))
            alice.retract(comment)
    
    Jonne Haß's avatar
    Jonne Haß a validé
          end