Skip to content
Extraits de code Groupes Projets
posts_controller_spec.rb 938 octets
Newer Older
  • Learn to ignore specific revisions
  • maxwell's avatar
    maxwell a validé
    #   Copyright (c) 2010, Diaspora Inc.  This file is
    #   licensed under the Affero General Public License version 3 or later.  See
    #   the COPYRIGHT file.
    
    require 'spec_helper'
    
    describe PostsController do
      before do
    
    maxwell's avatar
    maxwell a validé
      end
    
    maxwell's avatar
    maxwell a validé
      describe '#show' do
        it 'shows a public post' do
    
          status = alice.post(:status_message, :text => "hello", :public => true, :to => 'all')
    
    maxwell's avatar
    maxwell a validé
    
          get :show, :id => status.id
          response.status= 200
        end
    
        it 'does not show a private post' do
    
          status = alice.post(:status_message, :text => "hello", :public => false, :to => 'all')
    
    maxwell's avatar
    maxwell a validé
          get :show, :id => status.id
          response.status = 302
        end
    
    
        it 'redirects to the proper show page if the user has visibility of the post' do
          status = alice.post(:status_message, :text => "hello", :public => true, :to => 'all')
          sign_in bob
          get :show, :id => status.id
          response.should be_redirect
        end
    
    maxwell's avatar
    maxwell a validé
      end
    end