diaspora/'

43 lines
1.1 KiB
Text

# 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 AspectMembershipsController do
before do
@user = alice
@user2 = bob
@aspect0 = @user.aspects.first
@aspect1 = @user.aspects.create(:name => "another aspect")
@aspect2 = @user2.aspects.first
@contact = @user.contact_for(@user2.person)
@user.getting_started = false
@user.save
sign_in :user, @user
@controller.stub(:current_user).and_return(@user)
request.env["HTTP_REFERER"] = 'http://' + request.host
end
describe "#new" do
it 'succeeds' do
get :new
response.should be_success
end
end
describe "#destroy" do
it 'removes contacts from an aspect' do
@user.add_contact_to_aspect(@contact, @aspect1)
delete :destroy,
:format => 'js', :id => 123,
:person_id => @user2.person.id,
:aspect_id => @aspect0.id
response.should be_success
@aspect0.reload
@aspect0.contacts.include?(@contact).should be false
end
end
end