Skip to content
Extraits de code Groupes Projets
reshares_controller_spec.rb 1,02 ko
Newer Older
  • Learn to ignore specific revisions
  • require 'spec_helper'
    
    
      describe '#create' do
    
        let(:post_request!) {
          post :create, :format => :json, :root_guid => @post_guid
        }
    
        before do
    
    Jonne Haß's avatar
    Jonne Haß a validé
          @post_guid = FactoryGirl.create(:status_message, :public => true).guid
    
        it 'requires authentication' do
    
          response.should_not be_success
        end
    
        context 'with an authenticated user' do
          before do
            sign_in :user, bob
            @controller.stub(:current_user).and_return(bob)
          end
    
          it 'succeeds' do
            response.should be_success
    
          end
    
          it 'creates a reshare' do
            expect{
    
            }.to change(Reshare, :count).by(1)
    
          end
    
          it 'after save, calls add to streams' do
            bob.should_receive(:add_to_streams)
    
    
          it 'calls dispatch' do
            bob.should_receive(:dispatch_post).with(anything, hash_including(:additional_subscribers))