diff --git a/features/disconnects_users.feature b/features/disconnects_users.feature new file mode 100644 index 0000000000000000000000000000000000000000..422e8beb191f8e6e0f75447158cf16b7a42d9d52 --- /dev/null +++ b/features/disconnects_users.feature @@ -0,0 +1,60 @@ +@javascript +Feature: disconnecting users + In order to deal with life + As a User + I want to be able to disconnect from others + + Background: + Given a user with email "bob@bob.bob" + And a user with email "alice@alice.alice" + And a user with email "bob@bob.bob" is connected with "alice@alice.alice" + When I sign in as "bob@bob.bob" + And I am on the aspects manage page + Then I should see 1 contact in "Besties" + + + Scenario: remove contact from the contact show page + When I am on "alice@alice.alice"'s page + And I follow "edit aspect membership" + And I preemptively confirm the alert + And I follow "remove contact" in the modal window + + And I wait for the ajax to finish + And I am on the aspects manage page + Then I should see no contacts in "Besties" + + + Scenario: cancel removing contact from the contact show page + When I am on "alice@alice.alice"'s page + And I follow "edit aspect membership" + And I preemptively reject the alert + And I follow "remove contact" in the modal window + + And I wait for the ajax to finish + And I am on the aspects manage page + Then I should see 1 contact in "Besties" + + Scenario: remove contact from the aspect edit page + When I go to the home page + And I follow "Besties" within "#aspect_listings" + + And I wait for the ajax to finish + And I preemptively confirm the alert + And I press the first ".added" within "#facebox .contact_list ul > li:first-child" + + And I wait for the ajax to finish + And I am on the aspects manage page + Then I should see no contacts in "Besties" + + Scenario: cancel removing contact from the contact show page + When I go to the home page + And I follow "Besties" within "#aspect_listings" + And I wait for the ajax to finish + + And I preemptively reject the alert + And I press the first ".added" within "#facebox .contact_list ul > li:first-child" + + And I wait for the ajax to finish + And I am on the aspects manage page + Then I should see 1 contact in "Besties" + diff --git a/spec/javascripts/contact-list-spec.js b/spec/javascripts/contact-list-spec.js new file mode 100644 index 0000000000000000000000000000000000000000..6dc20a316fc9bb1d8974ae81213e5ab96fd55cd9 --- /dev/null +++ b/spec/javascripts/contact-list-spec.js @@ -0,0 +1,21 @@ +/* Copyright (c) 2010, Diaspora Inc. This file is +* licensed under the Affero General Public License version 3 or later. See +* the COPYRIGHT file. +*/ + +describe("Contact List", function() { + describe("disconnectUser", function() { + it("does an ajax call to person delete with the passed in id", function(){ + var id = '3'; + spyOn($,'ajax').andCallThrough(); + List.disconnectUser(id); + expect($.ajax).toHaveBeenCalledWith( + url: "/people/" + id, + type: "DELETE", + success: function(){ + $('.contact_list li[data-guid='+id+']').fadeOut(200); + } + ); + }); + }); +});