Skip to content
Extraits de code Groupes Projets
share_visibilities_controller_spec.rb 1,17 ko
Newer Older
  • Learn to ignore specific revisions
  • danielgrippi's avatar
    danielgrippi a validé
    #   Copyright (c) 2010-2011, Diaspora Inc.  This file is
    
    #   licensed under the Affero General Public License version 3 or later.  See
    #   the COPYRIGHT file.
    
    require 'spec_helper'
    
    
    Manuel Schölling's avatar
    Manuel Schölling a validé
    describe ShareVisibilitiesController do
    
        @status = alice.post(:status_message, :text => "hello", :to => alice.aspects.first)
    
    zhitomirskiyi's avatar
    zhitomirskiyi a validé
        context "on a post you can see" do
          it 'succeeds' do
    
            put :update, :format => :js, :id => 42, :post_id => @status.id
    
    zhitomirskiyi's avatar
    zhitomirskiyi a validé
            response.should be_success
          end
    
          it 'it calls toggle_hidden_shareable' do
            @controller.current_user.should_receive(:toggle_hidden_shareable).with(an_instance_of(Post))
    
            put :update, :format => :js, :id => 42, :post_id => @status.id
    
    zhitomirskiyi's avatar
    zhitomirskiyi a validé
          end
    
      describe "#accessible_post" do
        it "memoizes a query for a post given a post_id param" do
          id = 1
          @controller.params[:post_id] = id
    
          @controller.params[:shareable_type] = 'Post'
    
    
          Post.should_receive(:where).with(hash_including(:id => id)).once.and_return(stub.as_null_object)
          2.times do |n|
            @controller.send(:accessible_post)
          end
        end
      end