Newer
Older
# 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 PostVisibilitiesController do
before do
@status = alice.post(:status_message, :text => "hello", :to => alice.aspects.first)
describe '#update' do
before do
put :update, :format => :js, :id => 42, :post_id => @status.id
it 'marks hidden if visible' do
put :update, :format => :js, :id => 42, :post_id => @status.id
@vis.reload.hidden.should be_true
it 'marks visible if hidden' do
@vis.update_attributes(:hidden => true)
put :update, :format => :js, :id => 42, :post_id => @status.id
@vis.reload.hidden.should be_false
sign_in :user, eve
it 'does not let a user destroy a visibility that is not theirs' do
lambda {
put :update, :format => :js, :id => 42, :post_id => @status.id
}.should_not change(@vis.reload, :hidden).to(true)
end
it 'does not succeed' do
put :update, :format => :js, :id => 42, :post_id => @status.id